Calculating natural number square roots

Introduction

Introduction

We might want an algorithm that returns \(4\) for \(f(17)\). The floor of the square root.

This is useful, for example, for factorising a number.

We can start at \(0\) and square numbers and see if the result is larget than \(x\), incrementing each time.

while i * i <= x:
    x += 1;
return x - 1;