I'll argue that, during trial division (checking whether is a prime, for example) it is not necessary to test if is divisible by , or , down to a given number.
Suppose 17, for example (a prime). Using to mean x does not divide y
, and testing whether 17 is divisible by numbers between 1 and 17, suppose we get to 8; and we realise ; naturally we would test .
But if 9 divided 17, that would imply . This follows from the definition of division. To be divisible (loosely) means that a given number can be expressed as a product of two other numbers. But the least possible value of is 2, and , and so we conclude no number bigger than 8 can be a divisor to 17 — this, together with knowning no number up to 8 divides 17, means 17 is a prime number.
A possible upper bound for checking division of primes could be , but, in fact, the best bound is ; the reason why is left as an exercise.