Calculating a 2-adic square root

This returns the first n binary digits of a 2-adic sqroot x of a positive integer a=8k+1. Here x ≡ 1 (mod 4).
The arithmetic is done in base 2.
This is a BCMATH translation of a BC program.

(See lecture notes and solutions).

Enter a (> 0, a=8k+1):
Enter n (> 0):
Last modified 18th March 2004
Return to main page