1

Let $S_p = \{x^2 \bmod p : x\in\mathbb N\}$, with $p$ prime.

Is there an efficient way to determine if an arbitrary $m \not \in S_p$, where $m \in\mathbb N \bmod p$, without generating $S_p$?

E.g. $S_5 = \{0, 1, 4\}$, $m \in \{2, 3\}$.

Also is there a way to estimate $|S_p|$?

1 Answers1

1

To check if a number is a square or non-square mod $p$, you can use Euler's criterion: compute $a^{\frac{p-1}{2}}$ (mod p) and check if it is equal to 1 or -1.

The number of squares is $(p+1)/2$ as the earlier answer shows.

Aravind
  • 6,150