quadratic residues and quartic residues modulo primesmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9....

22
Int. J. Number Theory 16 (2020), no. 8, 1833–1858. QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES ZHI-WEI SUN Abstract. In this paper we study some products related to quadratic residues and quartic residues modulo primes. Let p be an odd prime and let A be any integer. We determine completely the product fp(A) := Y 16i,j6(p-1)/2 p-i 2 -Aij-j 2 (i 2 - Aij - j 2 ) modulo p; for example, if p 1 (mod 4) then fp(A) -(A 2 + 4) (p-1)/4 (mod p) if ( A 2 +4 p )=1, (-A 2 - 4) (p-1)/4 (mod p) if ( A 2 +4 p )= -1, where ( · p ) denotes the Legendre symbol. We also determine (p-1)/2 Y i,j=1 p-2i 2 +5ij+2j 2 ( 2i 2 +5ij +2j 2 ) and (p-1)/2 Y i,j=1 p-2i 2 -5ij+2j 2 ( 2i 2 - 5ij +2j 2 ) modulo p. 1. Introduction For n Z + = {1, 2, 3,...} and x = a/b with a, b Z, b 6= 0 and gcd(b, n) = 1, we let {x} n denote the unique integer r ∈{0,...,n - 1} with r x (mod n) (i.e., a br (mod n)). The well-known Gauss Lemma (see, e.g., [6, p. 52]) states that for any odd prime p and integer x 60 (mod p) we have x p =(-1) |{16k<p/2: {kx}p>p/2}| , (1.1) where ( · p ) is the Legendre symbol. This was extended to Jacobi symbols by M. Jenkins [7] in 1867, who showed (by an elementary method) that for any positive odd integer n and integer x with gcd(x, n) = 1 we have x n =(-1) |{16k<n/2: {kx}n>n/2}| , (1.2) where ( · n ) is the Jacobi symbol. In the textbook [9, Chapters 11-12], H. Rademacher supplied a proof of Jenkins’ result by using subtle properties of quadratic Gauss sums. Now we present our first new theorem. Theorem 1.1. Let n be a positive odd integer, and let x Z with gcd(x(1 -x),n)= 1. Then (-1) |{16k<n/2: {kx}n>k}| = 2x(1 - x) n . (1.3) Key words and phrases. Quadratic residues, quartic residues, congruences, Lucas sequences. 2020 Mathematics Subject Classification. Primary 11A15; Secondary 11A07, 11B39. 1

Upload: others

Post on 18-Aug-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

Int. J. Number Theory 16 (2020), no. 8, 1833–1858.

QUADRATIC RESIDUES AND QUARTIC RESIDUES

MODULO PRIMES

ZHI-WEI SUN

Abstract. In this paper we study some products related to quadratic residuesand quartic residues modulo primes. Let p be an odd prime and let A be any

integer. We determine completely the product

fp(A) :=∏

16i,j6(p−1)/2

p-i2−Aij−j2

(i2 −Aij − j2)

modulo p; for example, if p ≡ 1 (mod 4) then

fp(A) ≡

−(A2 + 4)(p−1)/4 (mod p) if (A2+4p

) = 1,

(−A2 − 4)(p−1)/4 (mod p) if (A2+4p

) = −1,

where ( ·p

) denotes the Legendre symbol. We also determine

(p−1)/2∏i,j=1

p-2i2+5ij+2j2

(2i2 + 5ij + 2j2

)and

(p−1)/2∏i,j=1

p-2i2−5ij+2j2

(2i2 − 5ij + 2j2

)modulo p.

1. Introduction

For n ∈ Z+ = {1, 2, 3, . . .} and x = a/b with a, b ∈ Z, b 6= 0 and gcd(b, n) = 1,we let {x}n denote the unique integer r ∈ {0, . . . , n− 1} with r ≡ x (mod n) (i.e.,a ≡ br (mod n)). The well-known Gauss Lemma (see, e.g., [6, p. 52]) states thatfor any odd prime p and integer x 6≡ 0 (mod p) we have(

x

p

)= (−1)|{16k<p/2: {kx}p>p/2}|, (1.1)

where ( ·p ) is the Legendre symbol. This was extended to Jacobi symbols by M.

Jenkins [7] in 1867, who showed (by an elementary method) that for any positiveodd integer n and integer x with gcd(x, n) = 1 we have(x

n

)= (−1)|{16k<n/2: {kx}n>n/2}|, (1.2)

where ( ·n ) is the Jacobi symbol. In the textbook [9, Chapters 11-12], H. Rademachersupplied a proof of Jenkins’ result by using subtle properties of quadratic Gausssums.

Now we present our first new theorem.

Theorem 1.1. Let n be a positive odd integer, and let x ∈ Z with gcd(x(1−x), n) =1. Then

(−1)|{16k<n/2: {kx}n>k}| =

(2x(1− x)

n

). (1.3)

Key words and phrases. Quadratic residues, quartic residues, congruences, Lucas sequences.2020 Mathematics Subject Classification. Primary 11A15; Secondary 11A07, 11B39.

1

Page 2: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

2 Z.-W. SUN

Also,

(−1)|{16k<n/2: {kx}n>n/2 & {k(1−x)}n>n/2}| =

(2

n

), (1.4)

(−1)|{16k<n/2: {kx}n<n/2 & {k(1−x)}n<n/2}| =

(2x(x− 1)

n

), (1.5)

and

(−1)|{16k<n/2: {kx}n>n/2>{k(1−x)}n}| =

(2x

n

). (1.6)

Let p be an odd prime, and let a, b, c ∈ Z and

Sp(a, b, c) :=∏

16i<j6p−1

p-ai2+bij+cj2

(ai2 + bij + cj2). (1.7)

Using Theorem 1.1, together with [15, Theorem 1.2], we completely determineSp(a, b, c) mod p in terms of Legendre symbols.

Theorem 1.2. Let p be an odd prime, and let a, b, c ∈ Z and ∆ = b2 − 4ac. Whenp - ac(a+ b+ c), we have

Sp(a, b, c) ≡

{(a(a+b+c)

p ) (mod p) if p | ∆,−(ac(a+b+c)∆

p ) (mod p) if p - ∆.(1.8)

In the case p | ac(a+ b+ c), we have

Sp(a, b, c) ≡

0 (mod p) if p | a, p | b and p | c,−(−ap ) (mod p) if p - a, p | b and p | c,−( bp ) (mod p) if p | a, p - b and p | c,−(−cp ) (mod p) if p | a, p | b and p - c,−( cp ) (mod p) if p | a, p - bc and p | b+ c,

−(ap ) (mod p) if p - ab, p | a+ b and p | c,−(−ap ) (mod p) if p - ac, p | a− c and p | a+ b+ c,

(−acp ) (mod p) if p - ac(a− c) and p | a+ b+ c,

(−a(a+b)p ) (mod p) if p - ab(a+ b) and p | c,

(−c(b+c)p ) (mod p) if p | a and p - bc(b+ c),

(1.9)

We will prove Theorem 1.1 and those parts of Theorem 1.2 not covered by [15,Theorem 1.2] in Section 2.

Let p be an odd prime. For a, b, c ∈ Z we introduce

Tp(a, b, c) :=

(p−1)/2∏i,j=1

p-ai2+bij+cj2

(ai2 + bij + cj2). (1.10)

Our following theorem determines Tp(1,−(a+b),−1) modulo p for all a, b ∈ Z withab ≡ −1 (mod p).

Page 3: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 3

Theorem 1.3. Let p be any odd prime, and let a, b ∈ Z with ab ≡ −1 (mod p).Set

{a, b}p :=

(p−1)/2∏i,j=1

i6≡aj,bj (mod p)

(i− aj)(i− bj), (1.11)

which is congruent to Tp(1,−(a+ b),−1) modulo p.(i) We have

−{a, b}p ≡

{(a−bp ) (mod p) if p ≡ 1 (mod 4) & p - (a− b),(a(a−b)

p ) = (a2+1p ) (mod p) if p ≡ 3 (mod 4).

(1.12)

(ii) If a ≡ b (mod p) and p ≡ 1 (mod 8), then

{a, b}p ≡ (−1)(p+7)/8 p− 1

2! (mod p).

If p ≡ 5 (mod 8) and a ≡ b ≡ (−1)k((p− 1)/2)! (mod p) with k ∈ {0, 1}, then

{a, b}p ≡ (−1)k+(p−5)/8 (mod p).

Our proof of Theorem 1.3 will be given in Section 3.For any A ∈ Z, we define the Lucas sequences {un(A)}n>0 and {vn(A)}n>0 by

u0(A) = 0, u1(A) = 1, and un+1(A) = Aun(A) + un−1(A) for n = 1, 2, 3, . . . ,

and

v0(A) = 2, v1(A) = A, and vn+1(A) = Avn(A) + vn−1(A) for n = 1, 2, 3, . . . .

It is well known that

un(A) =αn − βn

α− βand vn(A) = αn + βn

for all n ∈ N = {0, 1, 2, . . .}, where

α =A+√A2 + 4

2and β =

A−√A2 + 4

2.

Thus (A±√A2 + 4

2

)n=vn(A)± un(A)

√A2 + 4

2for all n ∈ N. (1.13)

Now we state our fourth theorem which determines Tp(1,−A,−1) for any oddprime p and integer A.

Theorem 1.4. Let p be an odd prime and let A ∈ Z.(i) Suppose that p | (A2 + 4). Then p ≡ 1 (mod 4), A/2 ≡ (−1)k((p −

1)/2)! (mod p) for some k ∈ {0, 1}, and

Tp(1,−A,−1) ≡

{(−1)(p+7)/8((p− 1)/2)! (mod p) if p ≡ 1 (mod 8),

(−1)k+(p−5)/8 (mod p) if p ≡ 5 (mod 8).(1.14)

(ii) When (A2+4p ) = 1, we have

Tp(1,−A,−1) ≡

{−(A2 + 4)(p−1)/4 (mod p) if p ≡ 1 (mod 4),

−(A2 + 4)(p+1)/4u(p−1)/2(A)/2 (mod p) if p ≡ 3 (mod 4).

(1.15)

Page 4: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

4 Z.-W. SUN

(iii) When (A2+4p ) = −1, we have

Tp(1,−A,−1) ≡

{(−A2 − 4)(p−1)/4 (mod p) if p ≡ 1 (mod 4),

(−A2 − 4)(p+1)/4u(p+1)/2(A)/2 (mod p) if p ≡ 3 (mod 4).

(1.16)

We will prove Theorem 1.4 in Section 4.Let p be a prime with p ≡ 1 (mod 4). Then (p−1

2 !)2 ≡ −1 (mod p) by Wilson’s

theorem. We may write p = x2 + y2 with x, y ∈ Z, x ≡ 1 (mod 4) and y ≡p−1

2 !x (mod p). Recall that an integer a not divisible by p is a quartic residue

modulo p (i.e., z4 ≡ a (mod p) for some z ∈ Z) if and only if a(p−1)/4 ≡ 1 (mod p).Dirichlet proved that 2 is a quartic residue modulo p if and only if 8 | y (see, e.g.,[6, p. 64, Exer. 28]). On the other hand, we have∣∣∣∣{1 6 k <

p

4:

(k

p

)= 1

}∣∣∣∣ ≡ 0 (mod 2) ⇐⇒ y ≡ (−1)(p−1)/4 − 1 (mod 8)

as discovered by K. Burde [2] and re-proved by K. S. Williams [16]. In view ofWilliams and J. D. Currie [17, (1.4)], we have

2(p−1)/4 ≡ (−1)|{16k<p4 : ( kp )=−1}| ×

{1 (mod p) if p ≡ 1 (mod 8),p−1

2 ! (mod p) if p ≡ 5 (mod 8).

By Dirichlet’s class number formula (see, e.g., L.E. Dickson [4, p. 101]),

p− 1

2− 4

∣∣∣∣{1 6 k <p

4:

(k

p

)= −1

}∣∣∣∣ = h(−4p),

where h(d) with d ≡ 0, 1 (mod 4) not a square denotes the class number of thequadratic field with discriminant d. In 1905, Lerch (see, e.g., [5]) proved that

h(−3p) = 2∑

16k<p/3

(k

p

).

By [17, Lemma 14],

(−3)(p−1)/4 ≡

{(−1)h(−3p)/4 (mod p) if p ≡ 1 (mod 12),

(−1)(h(−3p)−2)/4 p−12 ! (mod p) if p ≡ 5 (mod 12).

Thus, if p ≡ 1 (mod 12) then

(−3)(p−1)/4 ≡ (−1)12

∑(p−1)/3k=1 (( kp )−1)+ p−1

6 = (−1)|{16k<p3 : ( kp )=−1}| (mod p);

similarly, if p ≡ 5 (mod 12) then

(−3)(p−1)/4 ≡ (−1)|{16k<p3 : ( kp )=−1}| p− 1

2! (mod p).

From Theorem 1.4, we deduce the following result which will be proved in Section5.

Theorem 1.5. Let p be an odd prime.

Page 5: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 5

(i) We have

Tp(1,−1,−1) ≡

−5(p−1)/4 (mod p) if p ≡ 1, 9 (mod 20),

(−5)(p−1)/4 (mod p) if p ≡ 13, 17 (mod 20),

(−1)b(p−10)/20c (mod p) if p ≡ 3, 7 (mod 20),

(−1)b(p−5)/10c (mod p) if p ≡ 11, 19 (mod 20).

(1.17)

(ii) We have

Tp(1,−2,−1) ≡

−2(p−1)/4 (mod p) if p ≡ 1 (mod 8),

2(p−1)/4 (mod p) if p ≡ 5 (mod 8),

(−1)(p−3)/8 (mod p) if p ≡ 3 (mod 8),

(−1)(p−7)/8 (mod p) if p ≡ 7 (mod 8).

(1.18)

Now we state our sixth theorem.

Theorem 1.6. Let p > 3 be a prime and let δ ∈ {±1}. If p ≡ 1 (mod 4), then

Tp(2, 5δ, 2) ≡ (−1)b(p+11)/12c (mod p). (1.19)

When p ≡ 3 (mod 4), we have

Tp(2, 5δ, 2) ≡(

6

p

)δ2δ

((p− 3)/2

(p− 3)/4

)−2δ

(mod p). (1.20)

Note that there is no simple closed form for(

(p−3)/2(p−3)/4

)modulo a prime p ≡

3 (mod 4). For a prime p ≡ 1 (mod 4) with p = x2+y2 (x, y ∈ Z and x ≡ 1 (mod 4)),

Gauss showed the congruence(

(p−1)/2(p−1)/4

)≡ 2x (mod p), and S. Chowla, B. Dwork

and R. J. Evans [3] used Gauss and Jacobi sums to prove further that((p− 1)/2

(p− 1)/4

)≡ 2p−1 + 1

2

(2x− p

2x

)(mod p2),

which was first conjectured by F. Beukers. (See also [1, Chapter 9] for furtherrelated results.)

Though we have made some numerical tests via a computer, we are unable tofind general patterns for Tp(a, b, c) modulo p, where p is an arbitrary odd primeand a, b, c are arbitrary integers.

Let p be an odd prime. It is known (cf. [15, (1.6) and (1.7)]) that∏16i<j6(p−1)/2

p-i2+j2

(i2 + j2) ≡

{(−1)b(p−5)/8c (mod p) if p ≡ 1 (mod 4),

(−1)b(p+1)/8c (mod p) if p ≡ 3 (mod 4).

From this we immediately get∏16i<j6(p−1)/2

p-i2+j2

(i2 + j2

p

)=

{1 if p ≡ 1 (mod 4),

(−1)b(p+1)/8c if p ≡ 3 (mod 4).

As the product∏

16i<j6(p−1)/2(i2 − j2) modulo p was determined via [15, (1.5)],

we also know the value of the product∏16i<j6(p−1)/2

(i2 − j2

p

)=

∏16i<j6(p−1)/2

(i− jp

)(i+ j

p

)

Page 6: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

6 Z.-W. SUN

Motivated by this, we obtain the following result.

Theorem 1.7. Let p > 3 be a prime and let δ ∈ {±1}. Then

∏16i<j6(p−1)/2

(j + δi

p

)=

(−1)|{0<k<

p4 : ( kp )=δ}| if p ≡ 1 (mod 4),

(−1)(p−3)/8 if p ≡ 3 (mod 8),

(−1)(p+1)/8+(h(−p)+1)/2 if p ≡ 7 (mod 8).

(1.21)

We will prove Theorems 1.6 and 1.7 in Section 6, and pose ten conjectures inSection 7.

2. Proofs of Theorems 1.1 and 1.2

Proof of Theorem 1.1. For each k = 1, . . . , (n− 1)/2, we have⌊kx

n

⌋−⌊k(x− 1)

n

⌋=

{0 if {kx}n > k,

1 if {kx}n < k.

Thus ∣∣∣{1 6 k <n

2: {kx}n > k

}∣∣∣ =n− 1

2−

(n−1)/2∑k=1

(⌊kx

n

⌋−⌊k(x− 1)

n

⌋)and hence

(−1)|{16k<n/2: {kx}n>k}|(−1

n

)=(−1)

∑(n−1)/2k=1 bkx/nc+

∑(n−1)/2k=1 bk(x−1)/nc

=(−1)(∑(n−1)/2k=1 (2x−1)k−

∑(n−1)/2k=1 {kx}n−

∑(n−1)/2k=1 {k(x−1)}n)/n

=(−1)(n2−1)/8(−1)∑(n−1)/2k=1 {kx}n+

∑(n−1)/2k=1 {k(x−1)}n .

As {kx}n ≡ 1 + n− {kx}n (mod 2) for all k = 1, . . . , (n− 1)/2, we have

(n−1)/2∑k=1

{kx}n ≡(n−1)/2∑k=1

{kx}n<n/2

{kx}n +

(n−1)/2∑k=1

{kx}n>n/2

(1 + (n− {kx}n))

=

(n−1)/2∑k=1

{kx}n>n/2

1 +

(n−1)/2∑r=1

r

=∣∣∣{1 6 k <

n

2: {kx}n >

n

2

}∣∣∣+n2 − 1

8(mod 2).

and hence

(−1)∑(n−1)/2k=1 {kx}n =

(xn

)( 2

n

)=

(2x

n

)with the help of (1.2). Similarly,

(−1)∑(n−1)/2k=1 {k(x−1)}n =

(xn

)( 2

n

)=

(2(x− 1)

n

).

Page 7: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 7

In view of the above, we obtain

(−1)|{16k<n/2: {kx}n>k}| =

(−2

n

)(−1)

∑(n−1)/2k=1 {kx}n(−1)

∑(n−1)/2k=1 {k(x−1)}n

=

(−2

n

)(2x

n

)(2(x− 1)

n

)=

(2x(1− x)

n

).

This proves (1.3).When 1 6 k < n/2 and {kx}n < n/2, we clearly have

{kx}n > k ⇐⇒ {k(1− x)}n >n

2.

Thus ∣∣∣{1 6 k <n

2: {kx}n > k

}∣∣∣− ∣∣∣{1 6 k <n

2: {kx}n >

n

2

}∣∣∣=∣∣∣{1 6 k <

n

2: {kx}n <

n

2< {k(1− x)}n

}∣∣∣=∣∣∣{1 6 k <

n

2: {k(1− x)}n >

n

2

}∣∣∣−∣∣∣{1 6 k <

n

2: {kx}n >

n

2& {k(1− x)}n >

n

2

}∣∣∣ ,and hence by (1.2) and (1.3) we get

(−1)|{16k<n/2: {kx}n>n/2 & {k(1−x)}n>n/2}|

=(−1)|{16k<n/2: {kx}n>k}|(xn

)(1− xn

)=

(2

n

).

This proves (1.4).In view of (1.2) and (1.4), we also have

(−1)|{16k<n/2: {kx}n>n/2>{k(1−x)}n}|

=(−1)|{16k<n/2: {kx}n>n/2}|−||{16k<n/2: {kx}n>n/2 & {k(1−x)}n>n/2}|

=(xn

)( 2

n

)=

(2x

n

).

This proves (1.6).By (1.4) and (1.6), we have(

2

n

)(−1)|{16k<n/2: {kx}n<n/2 & {k(1−x)}n<n/2}|

=(−1)|{16k<n/2: ({kx}n−n/2)({k(1−x)}n−n/2)>0}|

=(−1)(n−1)/2−|{16k<n/2: {kx}n>n/2>{k(1−x)}n or {k(1−x)}n>n/2>{kx}n}|

=

(−1

n

)(2x

n

)(2(1− x)

n

)=

(x(x− 1)

n

).

So (1.5) also holds.The proof of Theorem 1.1 is now complete. �For any odd prime p and rational p-adic integer x, we define

Np(x) := |{1 6 k < p/2 : {kx}p > k}|. (2.1)

Page 8: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

8 Z.-W. SUN

Proof of Theorem 1.2. By parts (ii)-(iv) of Sun [15, Theorem 1.2], the desiredresult holds except for the cases

I. p - ac(a− c) and p | a+ b+ c,

II. p - ab(a+ b) and p | c,III. p | a and p - bc(b+ c).

In case I, by [15, Theorem 1.2(iii)] we have

Sp(a, b, c) ≡ (−1)Np(a/c)

(2c(a− c)

p

)(mod p).

As

(−1)Np(a/c) =

(2a(c− a)

p

)by Theorem 1.1, we obtain

Sp(a, b, c) ≡(

2a(c− a)

p

)(2c(a− c)

p

)=

(−acp

)(mod p).

In case II, by [15, Theorem 1.2(iv)] we have

Sp(a, b, c) ≡ (−1)Np(−a/b)(

2

p

)(mod p).

As

(−1)Np(−a/b) =

(−2a(a+ b)

p

)by Theorem 1.1, we get

Sp(a, b, c) ≡(−2a(a+ b)

p

)(2

p

)=

(−a(a+ b)

p

)(mod p).

In case III, by [15, Theorem 1.2(iv)] we have

Sp(a, b, c) ≡ (−1)Np(−c/b)(

2

p

)(mod p).

Since (−1)Np(−c/b) = (−2c(b+c)p ) by Theorem 1.1, we deduce that

Sp(a, b, c) ≡(−2c(b+ c)

p

)(2

p

)=

(−c(b+ c)

p

)(mod p).

In view of the above, we have completed the proof of Theorem 1.2. �

3. Proof of Theorem 1.3

Lemma 3.1. Let p be any odd prime. Then(p− 1

2!

)2

≡ (−1)(p+1)/2 (mod p), (3.1)

and ∏16i<j6(p−1)/2

(j2 − i2) ≡

{−((p− 1)/2)! (mod p) if p ≡ 1 (mod 4),

1 (mod p) if p ≡ 3 (mod 4).(3.2)

Remark 3.2. (3.1) is an easy consequence of Wilson’s theorem. (3.2) is also known,see [15, (1.5)] and its few-line proof there.

Page 9: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 9

Lemma 3.3. Let p be a prime with p ≡ 1 (mod 4). Then∣∣∣∣∣{

1 6 k 6p− 1

2:

{k × p− 1

2!

}p

>p

2

}∣∣∣∣∣ =p− 1

4. (3.3)

Proof. Let a = ((p − 1)/2)!. Then a2 ≡ −1 (mod p) by (3.1). For any k =1, . . . , (p − 1)/2, there is a unique integer k∗ ∈ {1, . . . , (p − 1)/2} congruent to akor −ak modulo p. Note that k∗ 6= k since a 6≡ ±1 (mod p). If {ak}p > p/2 then{ak∗}p = {a(−ak)}p = k < p/2; if {ak}p < p/2 then {ak∗}p = {a(ak)}p = p− k >p/2. So, exactly one of {ak}p and {ak∗}p is greater than p/2. Therefore (3.3)holds. �

Remark 3.4. In view of Gauss’ Lemma, Lemma 3.3 is stronger than the fact that

( ((p−1)/2)!p ) = ( 2

p ) for any prime p ≡ 1 (mod 4) (cf. [14, Lemma 2.3]).

Proof of Theorem 1.3. Observe that

(p−1)/2∏i,j=1

p-i2−j2

(i2 − j2) =∏

16i<j6(p−1)/2

(i2 − j2)(j2 − i2)

=(−1)((p−1)/2

2 )∏

16i<j6(p−1)/2

(j2 − i2)2

and hence

(p−1)/2∏i,j=1

p-i2−j2

(i2 − j2) ≡ −(

2

p

)(mod p) (3.4)

with the help of Lemma 3.1.When a ≡ ±1 (mod p), we have b ≡ ∓1 6≡ a (mod p) and hence

{a, b}p ≡ −(

2

p

)=

{−(a−bp ) (mod p) if p ≡ 1 (mod 4),

−(a2+1p ) (mod p) if p ≡ 3 (mod 4).

So (1.12) holds in the case a ≡ ±1 (mod p).Below we assume that a 6≡ ±1 (mod p). As ab ≡ −1 (mod p), we have

{a, b}p =

(p−1)/2∏i,j=1

i6≡aj,bj (mod p)

(i− aj)×(p−1)/2∏i,j=1

j 6≡ai,bi (mod p)

(j − bi)

≡(p−1)/2∏i,j=1

p-(i−aj)(j+ai)

(i− aj)×(p−1)/2∏i,j=1

p-(i+aj)(j−ai)

i+ aj

a(mod p).

(3.5)

(i) If p ≡ 3 (mod 4), then (−1p ) = −1 and hence a 6≡ b (mod p). Now we prove

(1.12) under the assumption a 6≡ b (mod p). Note that a2 6≡ ±1 (mod p).

Page 10: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

10 Z.-W. SUN

For 1 6 i, j 6 (p−1)/2, we cannot have i2−a2j2 ≡ j2−a2i2 ≡ 0 (mod p). Thus

∣∣∣∣{(i, j) : 1 6 i, j 6p− 1

2& p - (i+ aj)(j − ai)

}∣∣∣∣=

(p− 1

2

)2

−∣∣∣∣{(i, j) : 1 6 i, j 6

p− 1

2& p | i+ aj

}∣∣∣∣−∣∣∣∣{(i, j) : 1 6 i, j 6

p− 1

2& p | j − ai

}∣∣∣∣=

(p− 1

2

)2

−∣∣∣∣{1 6 j 6

p− 1

2: {aj}p >

p

2

}∣∣∣∣−∣∣∣∣{1 6 i 6

p− 1

2: {ai}p <

p

2

}∣∣∣∣=(p− 1)

p− 1

4− p− 1

2=p− 1

2· p+ 1

2− (p− 1)

and hence

a|{(i,j): 16i,j6(p−1)/2 & p-(i+aj)(j−ai)}| ≡ (a(p−1)/2)(p+1)/2 ≡(a

p

)(p+1)/2

(mod p).

Combining this with (3.5), we obtain

(a

p

)(p+1)/2

{a, b}p

≡(p−1)/2∏i,j=1

p-(i2−a2j2)(j2−a2i2)

(i2 − a2j2)×(p−1)/2∏i,j=1

i≡aj (mod p)

(i+ aj)×(p−1)/2∏i,j=1

i≡−aj (mod p)

(i− aj)

×(p−1)/2∏i,j=1

j−ai≡−a(i+bj)≡0 (mod p)

(i− aj)×(p−1)/2∏i,j=1

j+ai≡a(i−bj)≡0 (mod p)

(i+ aj)

≡(p−1)/2∏i,j=1

p-i2−a2j2

(i2 − a2j2)

/ (p−1)/2∏i,j=1

p|j2−a2i2

(i2 − a2j2)

× (−1)|{16j6(p−1)/2: {aj}p>p/2}|(p−1)/2∏j=1

(2aj)

× (−1)|{16j6(p−1)/2: {bj}p>p/2}|(p−1)/2∏j=1

(bj + aj) (mod p)

Page 11: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 11

Thus, by using (3.4) and Gauss’ Lemma, we see that(a

p

)(p+1)/2

{a, b}p ≡(p−1)/2∏i,k=1

p-i2−k2

(i2 − k2)

/ (p−1)/2∏i=1

(i2 − a2(a2i2))

×(ab

p

)(2a(a+ b))(p−1)/2

(p− 1

2!

)2

≡−(

2

p

)(−1

p

)(2(a2 − 1)(1− a4)

p

)=−

(a2 + 1

p

)= −

(a2 − ab

p

)(mod p).

This proves (1.12).(ii) Now we come to prove part (ii) of Theorem 1.3. Assume that a ≡ b (mod p).

Then a2 ≡ ab ≡ −1 (mod p) and hence p ≡ 1 (mod 4). As j ± ai ≡ ±a(i ∓aj) (mod p), by (3.5) we have

{a, b}p ≡a−|{(i,j): 16i,j6(p−1)/2 & p-i+aj}|(p−1)/2∏i,j=1p-i−aj

(i− aj)×(p−1)/2∏i,j=1p-i+aj

(i+ aj)

≡a−(p−1)2/4+|{(i,j): 16i,j6(p−1)/2 & p|i+aj}|(p−1)/2∏i,j=1

p-i2−(aj)2

(i2 − (aj)2)

×(p−1)/2∏i,j=1p|i−aj

(i+ aj)×(p−1)/2∏i,j=1p|i+aj

(i− aj)

≡a|{(i,j): 16i,j6(p−1)/2 & p|i+aj}|(p−1)/2∏i,k=1

p-i2−k2

(i2 − k2)

× (−1)|{16j6(p−1)/2: {aj}p>p/2}|(p−1)/2∏j=1

(2aj). (mod p)

Applying (3.4) and Gauss’ Lemma, from the above we get

{a, b}p ≡a|{16j6(p−1)/2: {aj}p>p/2}| ×(−(

2

p

))(a

p

)(2a)(p−1)/2 p− 1

2!

≡− p− 1

2!× a|{16j6(p−1)/2: {aj}p>p/2}| (mod p).

(3.6)

As a2 ≡ −1 ≡ ((p − 1)/2)!)2, we have a ≡ (−1)k((p − 1)/2)! (mod p) for somek ∈ {0, 1}. In view of Lemma 3.3,∣∣∣∣∣

{1 6 j 6

p− 1

2:

{−p− 1

2! j

}p

>p

2

}∣∣∣∣∣=

∣∣∣∣∣{

1 6 j 6p− 1

2:

{p− 1

2! j

}p

<p

2

}∣∣∣∣∣ =p− 1

4.

Page 12: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

12 Z.-W. SUN

Hence

a|{16j6(p−1)/2: {aj}p>p/2}|

=a(p−1)/4 = (−1)k(p−1)/4

(p− 1

2!

)(p−1)/4

{(p−1

2 !)2(p−1)/8 ≡ (−1)(p−1)/8 (mod p) if p ≡ 1 (mod 8),

(−1)k p−12 !(p−1

2 !)2(p−5)/8 ≡ (−1)k+(p−5)/8 p−12 ! (mod p) if p ≡ 5 (mod 8).

Combining this with (3.6) we immediately obtain the desired results in Theorem1.3(ii).

In view of the above, we have completed the proof of Theorem 1.3. �

4. Proof of Theorem 1.4

Proof of Theorem 1.4(i). As A2 ≡ −4 (mod p), we have (−1p ) = 1 and hence p ≡

1 (mod 4). Since ((p− 1)/2)2 ≡ −1 ≡ (A/2)2 (mod p), for some k ∈ {0, 1} we haveA/2 ≡ (−1)k((p−1)/2)! (mod p). Choose a, b ∈ Z with a ≡ b ≡ A/2 (mod p). Notethat {a, b}p ≡ Tp(1,−A,−1) (mod p). Applying Theorem 1.3(ii) we immediatelyget the desired (1.14). �

For any odd prime p and integer A with ∆ = A2 + 4 6≡ 0 (mod p), it is known(cf. [13, Lemma 2.3]) that

u(p−( ∆p )/2(A)v(p−( ∆

p ))/2(A) = up−( ∆p )(A) ≡ 0 (mod p).

Lemma 4.1. Let A ∈ Z and let p be an odd prime not dividing ∆ = A2 + 4. Then

p | v(p−( ∆p ))/2(A) ⇐⇒

(−1

p

)= −1. (4.1)

Remark 4.2. This is a known result, see, e.g., [10, Chapter 2, (IV.23)].

Proof of Theorem 1.4(ii). Let ∆ = A2 + 4. As (∆p ) = 1, we have d2 ≡ ∆ for

some d ∈ Z with p - d. Choose integers a and b such that

a ≡ A+ d

2(mod p) and b ≡ A− d

2(mod p).

Then a+b ≡ A (mod p) and ab ≡ (A2−d2)/4 ≡ −1 (mod p). Thus, for any i, j ∈ Zwe have

i2 −Aij − j2 ≡ (i− aj)(i− bj) (mod p).

If p ≡ 1 (mod 4), then

(A2 + 4)(p−1)/4 ≡ d(p−1)/2 ≡ (a− b)(p−1)/2 ≡(a− bp

)(mod p).

If p ≡ 3 (mod 4), then(2d(A+ d)

p

)=

(ad

p

)=

(a(a− b)

p

).

Page 13: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 13

For any positive integer n, clearly

un(A) =1√∆

((A+√

2

)n−

(A−√

2

)n)

=1

2n−1

b(n−1)/2c∑k=0

(n

2k + 1

)An−1−2k∆k

≡ 1

2n−1

b(n−1)/2c∑k=0

(n

2k + 1

)An−1−2kd2k

=1

d

((A+ d

2

)n−(A− d

2

)n)(mod p)

and

vn(A) =

(A+√

2

)n+

(A−√

2

)n=

1

2n−1

bn/2c∑k=0

(n

2k

)An−2k∆k

≡ 1

2n−1

bn/2c∑k=0

(n

2k

)An−2kd2k =

(A+ d

2

)n+

(A− d

2

)n(mod p).

In the case p ≡ 3 (mod 4), we have p | v(p−1)/2(A) by Lemma 4.1, and hence

(2δ(A+ d)

p

)≡d(p−1)/2

(A+ d

2

)(p−1)/2

≡ d(p−1)/2 v(p−1)/2(A) + du(p−1)/2(A)

2

≡(d2)(p+1)/4 u(p−1)/2(A)

2≡ ∆(p+1)/4u(p−1)/2(A)

2(mod p).

In view of the above, we obtain (1.15) from Theorem 1.3(i). �

Lemma 4.3. Let p be an odd prime, and let A ∈ Z with ∆ = A2 + 4 6≡ 0 (mod p).If p ≡ 1 (mod 4), then

u(p+( ∆p ))/2(A) ≡ ±∆(p−1)/4 (mod p). (4.2)

If p ≡ 3 (mod 4), then

u(p−( ∆p ))/2(A) ≡ ±2∆(p−3)/4 (mod p). (4.3)

Remark 4.4. This is a known result, see, e.g., [11, Theorem 4.1].

Proof of Theorem 1.4(iii). Let

∆ = A2 + 4, α =A+√

2and β =

A−√

2.

Page 14: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

14 Z.-W. SUN

As x2−Ax−1 = (x−α)(x−β), both α and β are algebraic integers. Observe that

(p−1)/2∏i,j=1

(i2 −Aij − j2)

=

(p−1)/2∏i,j=1

(i− αj)(i− βj) =

(p−1)/2∏i,j=1

(i− αj)×(p−1)/2∏i,j=1

(j − βi)

=

(p−1)/2∏i,j=1

(i− αj)×(p−1)/2∏i,j=1

αj + i

α= α−((p−1)/2)2

(p−1)/2∏i,j=1

(i2 − α2j2)

=α−((p−1)/2)2(p−1)/2∏i,j=1

(−j2)

(α2 − i2

j2

)

=(−α)−((p−1)/2)2

(p− 1

2!

)2 p−12

(p−1)/2∏j=1

(p−1)/2∏i=1

(α2 − i2

j2

)and hence

(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡ β((p−1)/2)2(p−1)/2∏k=1

(α2 − k2)(p−1)/2 (mod p)

(in the ring of all algebraic integers) since for any j, k = 1, . . . , (p− 1)/2 there is aunique i ∈ {1, . . . , (p− 1)/2} congruent to jk or −jk modulo p. Note that

(p−1)/2∏x=1

(x− k2) ≡ x(p−1)/2 − 1 (mod p).

Thus(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡β((p−1)/2)2

((α2)(p−1)/2 − 1)(p−1)/2

=β((p−1)/2)2 (αp−1 − 1

)(p−1)/2

=(

(−α)(p−1)/2 − β(p−1)/2)(p−1)/2

(mod p).

Case 1. p ≡ 1 (mod 4).In this case,

(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡(α(p−1)/2 − β(p−1)/2

α− β

)(p−1)/2

(α− β)(p−1)/2

=u(p−1)/2(A)(p−1)/2∆(p−1)/4 (mod p).

As (∆p ) = −1, by Lemma 4.3 we have u(p−1)/2(A) ≡ ±∆(p−1)/4 (mod p) and hence

u(p−1)/2(A)(p−1)/2 ≡ ∆p−1

2 ·p−1

4 ≡ (−1)(p−1)/4 (mod p).

Therefore(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡ (−∆)(p−1)/4 (mod p).

Page 15: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 15

Case 2. p ≡ 3 (mod 4).In this case,

(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡−(α(p−1)/2 + β(p−1)/2

)(p−1)/2

=− v(p−1)/2(A)(p−1)/2 (mod p).

It is easy to see that 2vn−1(A) = ∆un(A)−Avn(A) for all n = 1, 2, 3, . . .. Hence

2v(p−1)/2(A) = ∆u(p+1)/2(A)−Av(p+1)/2(A) ≡ ∆u(p+1)/2(A) (mod p)

since v(p+1)/2(A) = v(p−( ∆p ))/2(A) ≡ 0 (mod p) by Lemma 4.1. Thus

(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡−(

2u(p+1)/2(A)

)(p−1)/2

≡u(p+1)/2(A)

2

(u(p+1)/2(A)

2

)(p−3)/2

(mod p).

As (∆p ) = −1, by Lemma 4.3 we have u(p+1)/2(A) ≡ ±2∆(p−3)/4 (mod p), and

hence

(p−1)/2∏i,j=1

(i2 −Aij − j2) ≡u(p+1)/2(A)

2∆

p−34 ·

p−32 =

u(p+1)/2(A)

2∆

p+12 ·

p+14 −(p−1)

≡u(p+1)/2(A)

2(−∆)(p+1)/4 (mod p).

In view of the above, we have completed the proof of Theorem 1.4(iii). �

5. Proof of Theorem 1.5

Proof Theorem 1.5. Note that {un(1)}n>0 is just the Fibonacci sequence {Fn}n>0.By [12, Corollary 2(iii)], if p ≡ 3 (mod 4) and ( 5

p ) = 1, then

u(p−1)/2(1) = F(p−1)/2 ≡ −2(−1)b(p−5)/10c5(p−3)/4 (mod p)

and hence

−5(p+1)/4u(p−1)/2(1)

2≡ (−1)b(p−5)/10c5(p+1)/4+(p−3)/4 ≡ (−1)b(p−5)/10c (mod p).

Similarly, if p ≡ 3 (mod 4) and ( 5p ) = −1, then

u(p+1)/2(1) = F(p+1)/2 ≡ 2(−1)b(p−5)/10c5(p−3)/4 (mod p)

and hence

5(p+1)/4u(p+1)/2(1)

2≡ (−1)b(p−5)/10c5(p+1)/4+(p−3)/4 ≡ (−1)b(p+5)/10c (mod p).

Therefore Theorem 1.4 with A = 1 yields (1.17).When p ≡ 1 (mod 4), we obviously have

8(p−1)/4 = 2(p−1)/2+(p−1)/4 ≡(

2

p

)2(p−1)/4 = (−2)(p−1)/4 (mod p).

Page 16: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

16 Z.-W. SUN

If p ≡ 7 (mod 8), then

u(p−1)/2(2) ≡ (−1)(p+1)/82(p−3)/4 (mod p)

by [11, (1.7)], and hence

−8(p+1)/4u(p−1)/2(2)

2≡− 2(3p+3)/4(−1)(p+1)/82(p−7)/4 ≡ (−1)(p−7)/8 (mod p).

Similarly, if p ≡ 3 (mod 8), then

u(p+1)/2(2) ≡ (−1)(p+5)/82(p−3)/4 (mod p)

by [11, (1.7)], and hence

(−8)(p+1)/4u(p+1)/2(2)

2≡− 2(3p+3)/4(−1)(p+5)/82(p−7)/4 ≡ (−1)(p−3)/8 (mod p).

So Theorem 1.4 with A = 2 yields (1.18). This ends the proof. �

6. Proofs of Theorems 1.6 and 1.7

For n = 1, 2, 3, . . ., we adopt the notation

n!! :=

b(n−1)/2c∏k=0

(n− 2k).

Lemma 6.1. Let p > 3 be a prime. Then

p− 1

2!!

(p−1)/2∏i,j=1p-2i+j

(2i+ j) ≡(−2

p

)p− 3

2!!

(p−1)/2∏i,j=1p-2i−j

(2i− j) ≡ ±1 (mod p). (6.1)

Proof. Set

Ap :=p− 1

2!!

(p−1)/2∏i,j=1p-2i+j

(2i+ j) and Bp :=p− 3

2!!

(p−1)/2∏i,j=1p-2i−j

(2i− j).

Then

ApBp((p− 1)/2)!

≡(p−1)/2∏i,j=1p-2i+j

(2i+ j)×(p−1)/2∏i,j=1

p-2i+p−j

(2i+ p− j) =

(p−1)/2∏i=1

(1

2i

p−1∏j=0p-2i+j

(2i+ j)

)

≡(p−1)/2∏i=1

(p− 1)!

2i≡

(−2p )

((p− 1)/2)!(mod p)

and hence

ApBp ≡(−2

p

)(mod p). (6.2)

Page 17: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 17

On the other hand,

Bp((p− 3)/2)!!

=

(p−1)/2∏i,j=1

p-2(p+1

2−i)−j

(2

(p+ 1

2− i)− j)

≡(p−1)/2∏i,j=1

p-2i+j−1

(1− j − 2i) =

(p−1)/2∏i=1

−2i

(−(p− 1)/2− 2i)∗

(p−1)/2∏j=1p-j+2i

(−j − 2i)

≡ (−2)(p−1)/2((p− 1)/2)!∏16i<p/24i6=p+1

((p+ 1)/2− 2i)

(p−1)/2∏i,j=1p-2i+j

(2i+ j)

× (−1)∑(p−1)/2i=1 ((p−1)/2−|{16j6(p−1)/2: p|2i+j}|) (mod p),

where k∗ is 1 or k according as p | k or not. Note that∏16i<p/4

(p+ 1

2− 2i

)=p− 3

2!!.

Therefore(−2

p

)BpAp≡ ((p− 1)/2)!

((p− 1)/2)!!×

∏(p+1)/4<i<p/2

1

((p+ 1)/2− 2i)

× (−1)((p−1)/2)2−|{16i6(p−1)/2: 2i>p/2}|

≡ ((p− 3)/2)!!(−1)((p−1)/2)2−((p−1)/2−b(p−1)/4c)

(−1)b(p−1)/4c∏(p+1)/4<i<p/2(2i− (p+ 1)/2)

= 1 (mod p),

and hence

Ap ≡(−2

p

)Bp (mod p) (6.3)

which gives the first congruence in (6.1).Combining (6.2) and (6.3), we see that A2

p ≡ B2p ≡ 1 (mod p). So (6.1) does

hold. This ends the proof. �

Proof of Theorem 1.6. As 2i2 + δ5ij + 2j2 = (i+ δ2j)(2i+ δj), we have

(p−1)/2∏i,j=1

p-2i2+δ5ij+2j2

(2i2 + δ5ij + 2j2) =

(p−1)/2∏i,j=1

p-(i+δ2j)(2i+δj)

(i+ δ2j)×(p−1)/2∏i,j=1

p-(i+δ2j)(2i+δj)

(2i+ δj)

=

(p−1)/2∏i,j=1

p-(i+δ2j)(2i+δj)

(i+ δ2j)×(p−1)/2∏i,j=1

p-(i+δ2j)(2i+δj)

(2j + δi)

=

(p−1)/2∏i,j=1p-i+δ2j

δ(i+ δ2j)2 ×(p−1)/2∏i,j=1p|j+δ2i

1

δ(i+ δ2j)2.

Page 18: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

18 Z.-W. SUN

(Note that i + δ2j ≡ j + δ2i ≡ 0 (mod p) for no i, j = 1, . . . , (p − 1)/2.) Thus,applying Lemma 6.1 and (3.1) we get

(p−1)/2∏i,j=1

p-2i2+δ5ij+2j2

(2i2 + δ5ij + 2j2)

≡δ|(i,j): 16i,j6(p−1)/2 & p-i+δ2j}|

((p− 2 + δ)/2)!!2×

(p−1)/2∏i=1

{δ2i}p>p/2

1

δ(i+ δ2(p− 2δi))2

≡δ((p−1)/2)2−|{16j6(p−1)/2: {δ2j}p>p/2}|

((p− 2 + δ)/2)!!2×

(p−1)/2∏i=1

{δ2i}p>p/2

1

δ(i− 4i)2

≡ δ(p−1)2/4

((p− 2 + δ)/2)!!2×

(p−1)/2∏i=1

(3i)−1−δ ×bp/4c∏i=1

(3i)2δ

≡ δ(p−1)2/4

((p− 2 + δ)/2)!!2× 32δbp/4cbp/4c!2δ

((p− 1)/2)!1+δ

≡δ(p−1)2/4(−1)p+1

2 ·1+δ

2 32δbp/4c(

bp/4c!δ

((p− 2 + δ)/2)!!

)2

=(−1)(p+δ)/232δbp/4c(

bp/4c!δ

((p− 2 + δ)/2)!!

)2

(mod p).

Case 1. p ≡ 1 (mod 4).In this case,(

bp/4c!δ

((p− 2 + δ)/2)!!

)2

=

{1/2(p−1)/2 if δ = 1,

2(p−1)/2/((p− 1)/2)!2 if δ = −1.

Thus, with the help of (3.1) we have

(−1)(p+δ)/232δbp/4c(

bp/4c!δ

((p− 2 + δ)/2)!!

)2

≡(−1)(1+δ)/2

(3

p

)δ (2

p

)−δδ = −

(6

p

)= (−1)b(p+11)/12c (mod p),

and hence (1.19) follows from the above.Case 2. p ≡ 3 (mod 4).In this case, with the aid of (3.1) we have

(−1)(p+δ)/232δbp/4c(

bp/4c!δ

((p− 2 + δ)/2)!!

)2

≡(−1)(δ−1)/23δ((p−1)/2−1)

(2(p−3)/4

(p− 1)/2×(

(p−3)/2(p−3)/4

))2δ (p− 1

2!

)δ−1

≡δ(

3

p

)3−δ2δ(p+1)/2

((p− 3)/2

(p− 3)/4

)−2δ

≡(

6

p

)δ2δ

((p− 3)/2

(p− 3)/4

)−2δ

(mod p),

and hence (1.20) holds.

Page 19: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 19

In view of the above, we have completed the proof. �

Proof of Theorem 1.7. Let n = (p− 1)/2. Clearly,∏16i<j6n

(j − i) =

n∏k=1

k|{16i6n: i+k6n}| =

n∏k=1

kn−k

and hence ∏16i<j6n

(j − ip

)=

(n!

p

)n n∏k=12-k

(k

p

). (6.4)

Case 1. p ≡ 1 (mod 4).In this case, n is even, and hence by (6.4) and [15, (3.5)] we have∏

16i<j6n

(j − ip

)=

((n− 1)!!

p

)= (−1)|{0<k<

p4 : ( kp )=−1}|.

By (3.2) and [14, Lemma 2.3],∏16i<j6n

(j2 − i2

p

)=

(−n!

p

)=

(2

p

)= (−1)(p−1)/4.

Thus we also have∏16i<j6n

(j + i

p

)= (−1)(p−1)/4(−1)|{0<k<

p4 : ( kp )=−1}| = (−1)|{0<k<

p4 : ( kp )=1}|.

So (1.21) holds in this case.Case 2. p ≡ 3 (mod 4).In this case, n is odd and∏

16i<j6n

(j2 − i2

p

)=

(1

p

)= 1

by (3.2). So it suffices to prove (1.21) for δ = −1.In view of (6.4), we have∏

16i<j6n

(j − ip

)=

(n!

p

)(n!!

p

)=

((n− 1)!!

p

). (6.5)

If p ≡ 3 (mod 8), then by [15, (3.6)] we have((n− 1)!!

p

)= (−1)b(p+1)/8c = (−1)(p−3)/8

and hence (1.21) holds for δ = −1. When p ≡ 7 (mod 8), we have(n!

p

)=

((−1)(h(−p)+1)/2

p

)= (−1)(h(−p)+1)/2 and

(n!!

p

)= (−1)(p+1)/8

by Mordell [8] and Sun [15, (3.6)] respectively, hence (1.21) with δ = −1 followsfrom (6.5).

Combining the above, we have finished the proof of (1.21). �

Page 20: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

20 Z.-W. SUN

7. Some related conjectures

Motivated by our results in Section 1, here we pose 10 conjectures for furtherresearch. We have verified all the following conjectures for primes p < 13000.

Conjecture 7.1. Let p > 3 be a prime and let δ ∈ {±1}. Then∏16i<j6(p−1)/2

p-2i2+δ5ij+2j2

(2i2 + δ5ij + 2j2

p

)=

1

2

p

)((−1

p

)+

(2

p

)+

(6

p

)−(p

3

)).

(7.1)

Conjecture 7.2. Let p > 3 be a prime. Then∏16i<j6(p−1)/2

p-i2−ij+j2

(i2 − ij + j2

p

)=

{−1 if p ≡ 5, 7 (mod 24),

1 otherwise.(7.2)

Also, ∏16i<j6(p−1)/2

p-i2+ij+j2

(i2 + ij + j2

p

)=

{−1 if p ≡ 5, 11 (mod 24),

1 otherwise.(7.3)

Conjecture 7.3. Let p > 3 be a prime. Then∏16i<j6(p−1)/2

p-i2−3ij+j2

(i2 − 3ij + j2

p

)=

{−1 if p ≡ 7, 19 (mod 20),

1 otherwise.(7.4)

Also, ∏16i<j6(p−1)/2

p-i2+3ij+j2

(i2 + 3ij + j2

p

)=

{−1 if p ≡ 19, 23, 27, 31 (mod 40),

1 otherwise.(7.5)

Recall that for any prime p ≡ 3 (mod 4) the class number h(−p) of the imaginaryquadratic field Q(

√−p) is odd by [8].

Conjecture 7.4. Let δ ∈ {±1}.(i) For any prime p ≡ 1 (mod 12), we have

Tp(1, 4δ, 1) ≡ −3(p−1)/4 (mod p). (7.6)

(ii) Let p > 3 be a prime. Then∏16i<j6(p−1)/2

p-i2+δ4ij+j2

(i2 + δ4ij + j2

p

)

=

1 if p ≡ 1 (mod 24),

(−1)|{0<k<p4 : ( kp )=−1}| if p ≡ 17 (mod 24),

δ(−1)|{0<k<p12 : ( kp )=−1}|−1 if p ≡ 7 (mod 24),

δ(−1)|{0<k<p12 : ( kp )=−1}|+h(−p)−1

2 if p ≡ 19 (mod 24).

(7.7)

Conjecture 7.5. Let p > 3 be a prime. Then∏16i6j6(p−1)/2

p-4i2+j2

(4i2 + j2

p

)=

{1 if p ≡ 1, 7, 9, 19 (mod 20),

−1 otherwise.

Page 21: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMES 21

Conjecture 7.6. Let p > 3 be a prime. Then

(−1)|{16k<p/3: ( kp )=−1}|(p−1)/2∏i,j=1p-3i+j

(3i+ j

p

)=

{1 if p ≡ ±1 (mod 12),

(−1)bp/12c if p ≡ ±5 (mod 12),

and

(p−1)/2∏i,j=1p-3i−j

(3i− jp

)=

(−1)|{16k<p/3: ( kp )=−1}|+(p−1)/12 if p ≡ 1 (mod 12),

(−1)|{16k<p/3: ( kp )=−1}|−1 if p ≡ 5 (mod 12),

(−1)|{16k<p/6: ( kp )=1}|+(p+1)/4 if p ≡ 7 (mod 12),

−1 if p ≡ 11 (mod 12).

.

Conjecture 7.7. Let p > 3 be a prime. Then

(p−1)/2∏i,j=1p-4i+j

(4i+ j

p

)=

1 if p ≡ 1 (mod 4),

(−1)(h(−p)−1)/2+bp/8c if p ≡ 3 (mod 8),

(−1)|{16k<p/4: ( kp )=−1}| if p ≡ 7 (mod 8),

and(p−1)/2∏i,j=1p-4i−j

(4i− jp

)=

{(−1)(p−1)/4 if p ≡ 1 (mod 4),

(−1)bp/8c if p ≡ 3 (mod 4).

Conjecture 7.8. Let p > 5 be a prime. Then

(−1)|{16k<p/10: ( kp )=−1}|(p−1)/2∏i,j=1p-5i+j

(5i+ j

p

)

=

(−1)b(p+1)/10c if p ≡ ±1,±3 (mod 20),

(−1)bp/20c if p ≡ ±7 (mod 20),

(−1)b(p+9)/20c if p ≡ ±9 (mod 20),

and

(p−1)/2∏i,j=1p-5i−j

(5i− jp

)=

(−1)(h(−p)+1)/2 if p ≡ 3, 7 (mod 20),

(−1)(p+9)/20 if p ≡ −9 (mod 20),

(−1)|{16k<p/10: ( kp )=−1}|+(h(−p)−1)/2 if p ≡ −1 (mod 20),

(−1)|{16k<p/10: ( kp )=−1}|+b(p+3)/20c if p ≡ 1,−3 (mod 20),

(−1)|{16k<p/10: ( kp )=−1}|+b(p−3)/10c if p ≡ −7, 9 (mod 20).

Conjecture 7.9. For any prime p > 3, we have

(p−1)/2∏i,j=1p-6i+j

(6i+ j

p

)=

(−1)|{16k<p/12: ( kp )=−1}| if p ≡ 1 (mod 24),

(−1)|{p+3

4 6k6b p+13 c: ( kp )=−1}| if p ≡ 5,−7,−11 (mod 24),

(−1)(h(−p)+1)/2+b(p+1)/24c if p ≡ −1,−5 (mod 24),

(−1)bp/24c−1 if p ≡ 7, 11 (mod 24),

and(p−1)/2∏i,j=1p-6i−j

(6i− jp

)= (−1)|{

p+24 <k< p

3 : ( kp )=1}|.

Page 22: QUADRATIC RESIDUES AND QUARTIC RESIDUES MODULO PRIMESmaths.nju.edu.cn/~zwsun/205i.pdf · 2020. 9. 10. · (p 3)=4 2 (mod p): (1.20) Note that there is no simple closed form for (p

22 Z.-W. SUN

Conjecture 7.10. Let p > 3 be a prime. Then

(−1)|{16k<p/4: ( kp )=−1}|(p−1)/2∏i,j=1p-8i+j

(8i+ j

p

)=

{(−1)(p+1)/8 if p ≡ −1 (mod 8),

1 otherwise,

and(p−1)/2∏i,j=1p-8i−j

(8i− jp

)=

(−1)|{16k<p/4: ( kp )=1}| if p ≡ 1 (mod 4),

(−1)(h(−p)+1)/2+(p−3)/8 if p ≡ 3 (mod 8),

−1 if p ≡ 7 (mod 8).

Acknowledgments. The research is supported by the Natural Science Foundationof China (Grant No. 11971222). The author would like to thank the the referee forhelpful comments.

References

[1] B. C. Berndt, R. J. Evans and K. S. Williams, Gauss and Jacobi Sums, John Wiley & Sons,1998.

[2] K. Burde, Eine Verteilungseigenschaft der Legendresymbole, J. Number Theory 12 (1980),

273–277.[3] S. Chowla, B. Dwork and R. J. Evans, On the mod p2 determination of

((p−1)/2(p−1)/4

), J. Number

Theory 24 (1986), 188–196.

[4] L. E. Dickson, History of the Theory of Numbers, Vol. III, AMS Chelsea Publ., 1999.[5] R. H. Hudson and K. S. Williams, Class number formulae of Dirichlet type, Math. Comp. 39

(1982), 725–732.

[6] K. Ireland and M. Rosen, A Classical Introduction to Modern Number Theory, 2nd Edition,Graduate Texts in Math., 84, Springer, New York, 1990.

[7] M. Jenkins, Proof of an Arithmetical Theorem leading, by means of Gauss fourth demonstra-

tion of Legendres law of reciprocity, to the extension of that law, Proc. London Math. Soc. 2(1867) 29–32.

[8] L. J. Mordell, The congruence ((p− 1)/2)! ≡ ±1 (mod p), Amer. Math. Monthly 68 (1961)

145–146.[9] H. Rademacher, Lectures on Elementary Number Theory, Blaisdell Publishing Company,

New York, 1964.[10] P. Ribenboim, The Book of Prime Number Records, Springer, New York, 1980.

[11] Z.-H. Sun, Values of Lucas sequences modulo primes, Rocky Mountain J. Math. 33 (2013)

1123–1145.[12] Z.-H. Sun and Z.-W. Sun, Fibonacci numbers and Fermat’s last theorem, Acta Arith. 60

(1992) 371–388.

[13] Z.-W. Sun, Binomial coefficients, Catalan numbers and Lucas quotients, Sci. China Math.53 (2010) 2473–3488.

[14] Z.-W. Sun, On some determinants with Legendre symbol entries, Finite Fields Appl. 56

(2019) 285–307.[15] Z.-W. Sun, Quadratic residues and related permutations and identities, Finite Fields Appl.

59 (2019) 246–283.

[16] K. S. Williams, On the quadratic residues (mod p) in the interval (0, p/4), Canad. Math.Bull. 26 (1983) 123–124.

[17] K. S. Williams and J. D. Currie, Class numbers and biquadratic reciprocity, Canad. J. Math.

34 (1982) 969–988.

Department of Mathematics, Nanjing University, Nanjing 210093, People’s Republic

of China

E-mail address: [email protected]