Calculating a p-adic square root, p an odd prime

This returns the first n p-adic digits of a p-adic sqroot x of a quadratic residue (mod p).
Here p is an odd prime and x ≡ b (mod p), where b2 ≡ a (mod p), 0 < b < p.
The arithmetic is done in base p.

This is a BCMATH translation of a BC program.

Also see lecture notes and solutions.

Enter a (non-zero):
Enter n (> 0):
Enter p (an odd prime), where a(p-1)/21(mod p):
Last modified 22nd April 2004
Return to main page