#### Abstract

Let be a prime number and the finite field with elements. For , will denote the set of quadratic nonresidues less than or equal to . In this work we calculate the number of quadratic nonresidues in the shifted set .

#### 1. Introduction

Let be an odd prime, the finite field with elements, and the multiplicative group of . We will write to denote the set and to denote the Legendre symbol. Let be the set of quadratic residues modulo , including , and . 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 and , where , in particular, with ; 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 or . Let . In [6] the authors study the number of quadratic residues in the shifted set . Let and let 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 .

Theorem 1 (O. Perron). *Let be a prime number and the set of quadratic nonresidues modulo .*(1)*If and , then .*(2)*If , then and .*

*Proof. *See [2].

#### 2. Some Properties of

If is a prime number, then is a quadratic residue if and only if is also a quadratic residue modulo . We will call this property the* elementary symmetry*. The elementary symmetry implies that

If we consider smaller intervals the elementary symmetry is lost, but we still have some useful properties. In general, if , then

In particular, if we get the following.

Corollary 2. *If is a prime number, then *

Theorem 3. *If is a prime number, then *

*Proof. *The first assertion follows from 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 , then the numbers and are both quadratic residues or are both nonresidues modulo . If , then one of these numbers is a residue and the other one is a nonresidue. This fact gives a correspondence between the numbers and . 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 . To do this we arrange the elements in in pairs such that the first element of the pair is in the set and the second one is not, and then we make use of Theorem 1.

Lemma 4. *If is a prime number and is a quadratic nonresidue modulo , then is also a quadratic nonresidue and .*

We will call the pair of quadratic nonresidues in given by a* corresponding pair* of quadratic nonresidues. If the pair also satisfies we will say that is an* ordered corresponding pair* of quadratic nonresidues.

Note that as runs in then and the corresponding pair satisfies . In particular, for a corresponding pair to be ordered the following condition must be met:

In eventually appear some of the integers in , but if , these are not in and so we have to take these numbers out of consideration. If is the maximum nonresidue such that , and its corresponding pair satisfy , then half of the nonresidues left in are elements of (the ones of the form ) and the other half are not (the corresponding pairs ). Therefore, by Theorem 1 we get the following.

Theorem 5. *Let be a prime number, , **and . Suppose satisfies the condition**Then the following assertions hold: *(1)*If , then .*(2)*If , then .*

If , then in the previous theorem and when this happens . In this case the theorem does not apply because we get the equality in condition (7). When a corresponding pair satisfies we will call it an* overlap*.

An overlap only occurs when and . In this situation it is possible to count nonresidues in using basically the same idea with a slight modification: we must take the overlap into account because . 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 ; 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 and a prime , if is the number of overlaps (there is at most 1 overlap) and is the number of inner pairs, we get the following result.

Theorem 6. *Let be a prime number and and as in Theorem 5. Then the following assertions hold: *(1)*If , then .*(2)*If , then .*

For particular values of it is possible to give conditions on the prime 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 to exemplify the results of the previous section.

Proposition 7. *Let be a prime number. *(1)*If , then .*(2)*If , then .*

*Proof. *For , we get so that and an overlap can occur only if . From Corollary 2 this happens if and only if . By Theorem 6 the result follows.

From the previous proposition, we get the number of pairs of consecutive quadratic residues in the interval for a prime number .

Corollary 8. *Let be a prime number. The number of pairs of consecutive quadratic residues in is *(1)* if ,*(2)* if .*

Proposition 9. *Let be a prime number. *(1)*If , then .*(2)*If , then .*(3)*If and , then .*

*Proof. *For this value of there is no overlap; thus . For the first assertion, if then , so , and there are no inner pairs. From Theorem 6 it follows that there are nonresidues in . The second and third assertions follow from the fact that if and are both nonresidues, then there is an inner pair given by , which occurs if and only if and .

Proposition 10. *Let be a prime number. *(1)*If , then .*(2)*If and or and , then .*(3)*If , then .*(4)*If and , then .*

*Proof. *Note that in every case. If , then there is an overlap, which happens if . On the other hand, if and are both nonresidues, we get the inner pair . This occurs when and . Analyzing each case and making use of Theorem 6 the result follows.

Proposition 11. *Let be a prime number. *(1)*If or , then .*(2)*If and , then *(3)*If and , then *(4)*If and , then *(5)*If and , then .*(6)*If and , then *

*Proof. *Since is even, then there is no overlap; thus . But if and are both nonresidues, we get the inner pair . This happens if and only if and . If also and are both nonresidues, again is an inner pair, which occurs if and only if and . Finally, the set has a nonresidue only if . Therefore, in the first case one has and ; in the second case, and ; in the third and fourth cases, and ; in the fifth case, and ; and in the sixth case, and . The result follows using Theorem 6.

In order to count the number of nonresidues in for and we use the same idea; that is, we consider corresponding pairs of nonresidues; only this time the nonresidues in the set 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 , so they must not be counted. We call such a pair an* outer pair*. Letting be the number of overlaps and the number of outer pairs, we get the following result.

Theorem 12. *Let be a prime and , where .*(1)*If , then .*(2)*If , then .** is as it is in Theorem 5.*

It can be shown that the number of overlaps is the same for and for and that the number of inner pairs for equals the number of outer pairs for ; thus we get the following.

Corollary 13. *If is a prime number and , then there is such that if , then **and if , then **where and 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 for 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 .

#### Conflict of Interests

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).