Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

power_mod strange...

where is the error?

x = 15

z = power_mod(x,3,23) #z=15^3 mod 23

inverse = inverse_mod(3,23) #1/3 mod 23

assert mod(3*inverse,23)==1 #ok

y = power_mod(z,inverse,23) # y = 15^(3/3) = 15

print(y)

18

Thanks a lot to everyone