Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Math 201
Views: 76
'You can change the values of c and p below. Then hit shift and enter to evaluate x^2 mod p for all xs between 0 and p-1'
'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'
c = 3 p = 5 'The list below prints (a,a^2,c)' for x in [0..(p-1)]: x,mod(x^2,p),c
'The list below prints (a,a^2,c)' (0, 0, 3) (1, 1, 3) (2, 4, 3) (3, 4, 3) (4, 1, 3)
mod(c^((p-1)/2),p)
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). '
'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). '
c = 3 p = 5 for x in [0..(p-1)]: x,mod(x^2,p)- c
(0, 2) (1, 3) (2, 1) (3, 1) (4, 3)