'You can change the values of c and p above. Then hit shift and enter in the next row to evaluate x^2 mod p for all xs between 0 and p-1'
'The list below prints (a,a^2,c)'
(0, 0, 3)
(1, 1, 3)
(2, 4, 3)
(3, 4, 3)
(4, 1, 3)
4
'Rather than seeing if x^2 = c (mod p) we can look for values of zero. That is, see if x^2 - c = 0 (mod p). '
(0, 2)
(1, 3)
(2, 1)
(3, 1)
(4, 3)