Algorithm:
- square root of $n$
- test all primes lower than the square root of $n$ if they go evenly up into $n$; if not, $n$ is a prime
But do I have to take ceil$(n)$ or floor$(n)$ as the square root?
Algorithm:
But do I have to take ceil$(n)$ or floor$(n)$ as the square root?
Don't have to take the square root.
If you are testing a series of primes p, stop when n/p < p.