root algorithm

Upload: benjaminlloyd

Post on 27-Feb-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Root Algorithm

    1/1

    Square root algorithm:1) Divide the number into pairs of digits. The left most pair becomes the current target T.2) Find a digit D such that remainder R = T-D^2 is least possible. D becomes ourcurrent 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 current target T.2) Find a digit D such that remainder R = T-D^n is least possible. D becomes ourcurrent 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 possible. Append D to P, which becomes new P.5) Repeat 3, 4 until a satisfactory result is obtained.