Integer Square Root Article Index for
Integer
Website Links For
Square
 

Information About

Integer Square Root




Positive Integer ''n'' is the positive integer ''m'' which is the greatest integer less than or equal to the square root of ''n'',

: \mbox{isqrt}( n ) = \lfloor \sqrt n floor.

  • 5=25<27 and 6---6=36>27.



ALGORITHM


To calculate √''n'', and in particular, isqrt(''n''), one can use Newton's Method for the equation ''x''2 - ''n'' = 0, which gives us the Recursive formula
: {x}_{k+1} = rac{1}{2}\left(x_k + rac{ n }{x_k} ight), \ k \ge 0.
One can choose for example ''x''0 = ''n'' as initial guess.

The Sequence {''x k''} Converges Quadratically to √''n'' as
''k''→∞. It can be proved (the proof is not trivial) that one can stop as soon as