Square root of natural numbers #
This file defines an efficient implementation of the square root function that returns the
unique r
such that r * r ≤ n < (r + 1) * (r + 1)
.
Reference #
See [Wikipedia, Methods of computing square roots] (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_(base_2)).
IsSquare
can be decided on ℕ
by checking against the square root.