Вы находитесь на странице: 1из 1

Square root algorithm:

1) Divide the number into pairs of digits. The left most pair becomes the curren
t target T.
2) Find a digit D such that remainder R = T-D^2 is least possible. D becomes our
current partial solution P.
3) Append the next target to R and this becomes our new current tagret T.
4) Find a digit D such that remainder R = T - [append(2P, D)*D] is least possibl
e. Append D to P, which becomes new P.
5) Repeat 3, 4 until a satisfactory result is obtained.
Nth root algorithm:
1) Divide the number into sets of n digits. The left most set becomes the curren
t target T.
2) Find a digit D such that remainder R = T-D^n is least possible. D becomes our
current partial solution P.
3) Append the next target to R and this becomes our new current tagret T.
4) Find a digit D such that remainder R = T - [(10P+D)^n-(10P)^n] is least possi
ble. Append D to P, which becomes new P.
5) Repeat 3, 4 until a satisfactory result is obtained.

Вам также может понравиться