PROJECT EULER · #0255
Rounded Square Roots
We define the rounded-square-root of a positive integer
The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of
Let
If
If
Repeat:
until
As an example, let us find the rounded-square-root of
So, after just two iterations, we have found that the rounded-square-root of
The number of iterations required when using this method is surprisingly low.
For example, we can find the rounded-square-root of a
Using the procedure described above, what is the average number of iterations required to find the rounded-square-root of a
Give your answer rounded to
Note: The symbols
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.