§ Why searching for divisors upto sqrt(n)
works
- It's not that all divisors are smaller than n. For example, consider 14=7×2. 14∼4, but one of its diviors ( 7) is greater than 4.
- Rather, it is that if there is a divisor l (for large) which is larger than n, there will be another divisor s which is smaller than n.
- Proof: Suppose l÷n, l≥n. So there exists an s such that ls=n, or s=n/l.
- Since l≥n, n/l≤n/n=n. Thus s≤n.
- So if we wish to find some factor of n, we can simply search within the range n.
- If n has no factors in the range n, then n must be prime, for if n did have a larger factor, n would also have a smaller factor we would have found.