In number theory, the integer square root of a non-negative integer n, often abbreviated isqrt, is the non-negative integer m which is the greatest integer less than or equal to the square root of n. It answers the question of the largest whole number whose square does not exceed n, and so it can be computed using only integer arithmetic without floating point rounding. This makes it a small but useful building block for other procedures that need an exact whole-number answer, and there are several algorithms for computing it.
Connections
Uses Design Technique
Source Integer square root (Wikipedia)
Sources
Integer square root (Wikipedia)
Lead section
In number theory, the integer square root (isqrt) of a non-negative integer n is the non-negative integer m which is the greatest integer less than or equal to the square root of n, isqrt ( n ) = ⌊ n ⌋ . {\displaystyle \operatorname {isqrt} (n)=\lfloor {\sqrt {n}}\rfloor .} For example, isqrt ( 27 ) = ⌊ 27 ⌋ = ⌊ 5.19615242270663... ⌋ = 5. {\displaystyle \operatorname {isqrt} (27)=\lfloor {\sqrt {27}}\rfloor =\lfloor 5.19615242270663...\rfloor =5.}
Uses Design Technique: Recursion, Article body
It recursively splits the input number into high and low halves, computes the square root of the higher half, and then determines the lower half algebraically.
View the SourceReader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.