Let p=4k+1 be a prime number and Fp the finite field with p elements. For x∈1,n, Nx will denote the set of quadratic nonresidues less than or equal to x. In this work we calculate the number of quadratic nonresidues in the shifted set N(p-1)/2+a.
1. Introduction
Let p be an odd prime, Fp the finite field with p elements, and Fp∗ the multiplicative group of Fp. We will write a,n to denote the set {a,a+1,…,n} and (/p) to denote the Legendre symbol. Let R be the set of quadratic residues modulo p, including 0, and N=Fp∖R. The distribution of quadratic residues and nonresidues has been studied with great interest in the literature [1–3]. In [2] Perron finds the number of quadratic residues and nonresidues in the shifted sets R+a and N+a, where a∈Fp∗, in particular, with a=1; his result gives the number of pairs of consecutive quadratic residues and of nonresidues. Perron also gives nonsquare matrices having two properties: each row has the same number of elements in common with every other row and the corresponding elements of every two rows have the same difference. According to Brauer [4], Paley [5] found these matrices and used them in the construction of Hadamard matrices. Following Perron, we can ask what happens to the number of quadratic residues when we shift some subset of R or N. Let Rx={r∈R:1≤r≤x}. In [6] the authors study the number of quadratic residues in the shifted set R(p-1)/2+a. Let Nx={n∈N:1≤n≤x} and let p=4k+1 be a prime number. In this work we use Perron’s results and elementary techniques to determine the number of quadratic nonresidues (and hence the number of residues) in the set N(p-1)/2+a.
Theorem 1 (O. Perron).
Let p=4k+1 be a prime number and N the set of quadratic nonresidues modulo p.
If a∈R and a≠0, then N+a∩R=N+a∩N=k.
If a∈N, then |(N+a)∩R|=k+1 and |(N+a)∩N|=k-1.
Proof.
See [2].
2. Some Properties of <inline-formula>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M41">
<mml:mrow>
<mml:mi>R</mml:mi></mml:mrow>
</mml:math></inline-formula>
If p≡1(mod4) is a prime number, then a is a quadratic residue if and only if p-a is also a quadratic residue modulo p. We will call this property the elementary symmetry. The elementary symmetry implies that (1)∑n=1p-1/2np=0.
If we consider smaller intervals the elementary symmetry is lost, but we still have some useful properties. In general, if p=2k+1, then (2)kp=p-1/2p=2p-1p=1ifandonlyifp≡1,3mod8,-1ifandonlyifp≡5,7mod8.
In particular, if p=4k+1 we get the following.
Corollary 2.
If p≡1mod4 is a prime number, then (3)p-1/2p=1ifandonlyifp≡1mod8,-1ifandonlyifp≡5mod8.
Theorem 3.
If p=4k+1 is a prime number, then (4)1p-1/2-np=2p2n+1p.2p-1/2+np=2p2n-1p.
Proof.
The first assertion follows from p-1-2n/p=2/p((p-1-2n)/2)/p and the elementary symmetry. The proof of the second assertion is similar to the one of the first assertion.
According to the first assertion of the previous theorem we have that if p≡1(mod8), then the numbers p-1/2-n and 2n+1 are both quadratic residues or are both nonresidues modulo p. If p≡5(mod8), then one of these numbers is a residue and the other one is a nonresidue. This fact gives a correspondence between the numbers p-1/2-n and 2n+1. We can give a similar interpretation to the second assertion.
3. Main Results
In this section we count the number of nonresidues in the set N(p-1)/2+a. To do this we arrange the elements in N+a in pairs such that the first element of the pair is in the set N(p-1)/2+a and the second one is not, and then we make use of Theorem 1.
Lemma 4.
If p=4k+1 is a prime number and n=ni+a∈N+a is a quadratic nonresidue modulo p, then p-ni is also a quadratic nonresidue and p-ni∈N+a.
We will call the pair of quadratic nonresidues in N+a given by (ni+a,p-ni) a corresponding pair of quadratic nonresidues. If the pair also satisfies ni+a<p-ni we will say that (ni+a,p-ni) is an ordered corresponding pair of quadratic nonresidues.
Note that as ni runs in 1≤ni<(p-a)/2 then 1+a≤ni+a<p-a/2+a and the corresponding pair p-ni satisfies p-a/2+a<p-ni≤p-1. In particular, for a corresponding pair to be ordered the following condition must be met:(5)ni<p-a2.
In N+a eventually appear some of the integers in 0,a, but if a≤(p-1)/2, these are not in N(p-1)/2+a and so we have to take these numbers out of consideration. If nj is the maximum nonresidue such that nj≤(p-a)/2, nj+a∈N and its corresponding pair satisfy p-nj>(p-1)/2+a, then half of the nonresidues left in N+a are elements of N(p-1)/2+a (the ones of the form ni+a) and the other half are not (the corresponding pairs p-ni). Therefore, by Theorem 1 we get the following.
Theorem 5.
Let p=4k+1 be a prime number, a∈1,(p-1)/2, (6)nj=maxni∈N:ni≤p-a2,ni+a∈N,S=0,1,…,a-1,a∩N+a=i∈0,a:a-i∈Nand s=|S∩N|. Suppose nj satisfies the condition(7)p-nj>p-12+a.
Then the following assertions hold:
If a∈R, then |(N(p-1)/2+a)∩N|=(k-s)/2.
If a∈N, then |(N(p-1)/2+a)∩N|=(k-1-s)/2.
If (p-a)/2∈N, then in the previous theorem nj=(p-a)/2 and when this happens nj+a=p-nj. In this case the theorem does not apply because we get the equality in condition (7). When a corresponding pair satisfies ni+a=p-ni we will call it an overlap.
An overlap only occurs when nj=(p-a)/2∈Z and nj∈N. In this situation it is possible to count nonresidues in N(p-1)/2+a using basically the same idea with a slight modification: we must take the overlap into account because nj+a=p-nj∈N(p-1)/2+a. Thus, if an overlap occurs, we must take 1 off in the result of Theorem 5 before dividing by 2 and then we add 1.
Condition (7) may also fail when the left side is smaller than the right side; this happens when there is at least one corresponding pair whose elements are both in the set N(p-1)/2+a; thus in this case both of the pair elements must be taken into account. We call such pair an inner pair. The necessary modification to the result of Theorem 5 is clear: we add 1 for every existing inner pair.
Summarizing, for a given a and a prime p=4k+1, if oa is the number of overlaps (there is at most 1 overlap) and pa is the number of inner pairs, we get the following result.
Theorem 6.
Let p=4k+1 be a prime number and a∈1,(p-1)/2 and s as in Theorem 5. Then the following assertions hold:
If a∈R, then |(Np-1/2+a)∩N|=(k-s-oa)/2+oa+pa.
If a∈N, then |(Np-1/2+a)∩N|=(k-1-s-oa)/2+oa+pa.
For particular values of a it is possible to give conditions on the prime p so that hypothesis of Theorem 5 holds; moreover, it is possible to determine if an overlap occurs and the number of inner pairs.
4. Examples
In this section we use particular values of a to exemplify the results of the previous section.
Proposition 7.
Let p=4k+1 be a prime number.
If p≡1mod8, then |(N(p-1)/2+1)∩N|=k/2.
If p≡5mod8, then |(N(p-1)/2+1)∩N|=(k+1)/2.
Proof.
For a=1, we get S=∅ so that s=0 and an overlap can occur only if (p-1)/2∈N. From Corollary 2 this happens if and only if 2/p=-1. By Theorem 6 the result follows.
From the previous proposition, we get the number of pairs of consecutive quadratic residues in the interval 1,(p-1)/2 for a prime number p=4k+1.
Corollary 8.
Let p=4k+1 be a prime number. The number of pairs of consecutive quadratic residues in 1,(p-1)/2 is
(k-2)/2 if p≡1(mod8),
(k-1)/2 if p≡5(mod8).
Proposition 9.
Let p=4k+1 be a prime number.
If 2/p=1, then |(N(p-1)/2+2)∩N|=k/2.
If 2/p=3/p=-1, then |(N(p-1)/2+2)∩N|=(k-1)/2.
If 2/p=-1 and 3/p=1, then |(N(p-1)/2+2)∩N|=(k+1)/2.
Proof.
For this value of a there is no overlap; thus oa=0. For the first assertion, if 2/p=1 then S=∅, so s=0, and there are no inner pairs. From Theorem 6 it follows that there are (k-s)/2=k/2 nonresidues in N(p-1)/2+2. The second and third assertions follow from the fact that if ni=(p-2)/2=p-1/2-1 and ni+2=p-1/2+1 are both nonresidues, then there is an inner pair given by (ni+2,p-ni), which occurs if and only if 2/p=-1 and 3/p=1.
Proposition 10.
Let p=4k+1 be a prime number.
If 2/p=1, then |(N(p-1)/2+3)∩N|=k/2.
If 2/p=3/p=-1 and 5/p=1 or 2/p=5/p=-1 and 3/p=1, then |(N(p-1)/2+3)∩N|=(k+1)/2.
If 2/p=3/p=5/p=-1, then |(N(p-1)/2+3)∩N|=(k-1)/2.
If 2/p=-1 and 3/p=5/p=1, then |(N(p-1)/2+3)∩N|=(k+3)/2.
Proof.
Note that s=0 in every case. If (p-3)/2∈N, then there is an overlap, which happens if 2/p≠3/p. On the other hand, if ni=p-1/2-2 and ni+3=p-1/2+1 are both nonresidues, we get the inner pair (ni+3,p-ni). This occurs when 2/p=-1 and 5/p=1. Analyzing each case and making use of Theorem 6 the result follows.
Proposition 11.
Let p=4k+1 be a prime number.
If 2/p=5/p=1 or 2/p=3/p=1, then |(N(p-1)/2+4)∩N|=k/2.
If 2/p=7/p=-1 and 3/p=-1or5/p=-1, then (8)Np-1/2+4∩N=k-12.
If 2/p=-1,7/p=1 and 3/p=-1or5/p=-1, then (9)Np-1/2+4∩N=k+12.
If 2/p=7/p=-1 and 3/p=5/p=1, then (10)Np-1/2+4∩N=k+12.
If 2/p=1 and 3/p=5/p=-1, then |(N(p-1)/2+4)∩N|=(k+2)/2.
If 2/p=-1 and 3/p=5/p=7/p=1, then (11)Np-1/2+4∩N=k+32.
Proof.
Since a=4 is even, then there is no overlap; thus oa=0. But if ni=(p-4)/2=(p-1)/2-2 and ni+4 are both nonresidues, we get the inner pair (ni+4,p-ni). This happens if and only if 2/p≠5/p and 2/p≠3/p. If also ni=(p-4)/2-1=p-1/2-3 and ni+4 are both nonresidues, again (ni+4,p-ni) is an inner pair, which occurs if and only if 2/p≠7/p and 2/p=-1. Finally, the set S has a nonresidue only if 2∈N. Therefore, in the first case one has s=0 and pa=0; in the second case, s=1 and pa=0; in the third and fourth cases, s=1 and pa=1; in the fifth case, s=0 and pa=1; and in the sixth case, s=1 and pa=2. The result follows using Theorem 6.
In order to count the number of nonresidues in N(p-1)/2+a for a=p-b and b∈1,(p-1)/2 we use the same idea; that is, we consider corresponding pairs (ni+a,p-ni) of nonresidues; only this time the nonresidues in the set S are of interest and if an overlap occurs it must not be counted. Also, in this case, it is possible to have pairs whose elements are neither in N(p-1)/2+a, so they must not be counted. We call such a pair an outer pair. Letting oa be the number of overlaps and pa the number of outer pairs, we get the following result.
Theorem 12.
Let p=4k+1 be a prime and a=p-b, where b∈1,(p-1)/2.
If a∈R, then |(Np-1/2+a)∩N|=(k-s-oa)/2-pa+s.
If a∈N, then |(Np-1/2+a)∩N|=(k-1-s-oa)/2-pa+s.
s is as it is in Theorem 5.
It can be shown that the number of overlaps is the same for a and for p-a and that the number of inner pairs for a equals the number of outer pairs for p-a; thus we get the following.
Corollary 13.
If p=4k+1 is a prime number and a∈1,(p-1)/2, then there is m∈Z such that if a∈R, then (12)Np-1/2+a∩N=k+m2,Np-1/2+p-a∩N=k-m2,and if a∈N, then (13)Np-1/2+a∩N=k-1+m2,Np-1/2+p-a∩N=k-1-m2,where m=2pa+oa-s and s is as it is in Theorem 5.
As a consequence of the previous corollary, we easily get the number of quadratic nonresidues in the set N(p-1)/2+(p-a) for a=1,2,3,4 using Propositions 7, 9, 10, and 11. In Tables 1–4 we show these results along with the number of quadratic nonresidues in the set N(p-1)/2+a.
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgment
The first author acknowledges support from the National Council of Science and Technology (CONACYT) of México (Grant no. 25351).
BurdeK.Zur Verteilung quadratischer RestePerronO.Bemerkungen uber die Verteilung der quadratischen ResteWinterhofA.On the distribution of powers in finite fieldsBrauerA.On a new class of Hadamard determinantsPaleyR. E. A. C.On orthogonal matricesMeza-MorenoR.Pineda-RuelasM.Counting quadratic residues