scratch

§ Why Searching for Divisors Upto sqrt(n) Works

created 2021-07-30 · last edited 2022-05-30
  • It's not that all divisors are smaller than n\sqrt nn​. For example, consider 14=7×214 = 7 \times 214=7×2. 14∼4\sqrt{14} \sim 414​∼4, but one of its diviors ( 777) is greater than 4.
  • Rather, it is that if there is a divisor lll (for large) which is larger than n\sqrt nn​, there will be another divisor sss which is smaller than n\sqrt nn​.
  • Proof: Suppose l÷nl \div nl÷n, l≥nl \geq \sqrt nl≥n​. So there exists an sss such that ls=nls = nls=n, or s=n/ls = n / ls=n/l.
  • Since l≥nl \geq \sqrt nl≥n​, n/l≤n/n=nn / l \leq n / \sqrt n = \sqrt nn/l≤n/n​=n​. Thus s≤ns \leq \sqrt ns≤n​.
  • So if we wish to find some factor of nnn, we can simply search within the range n\sqrt nn​.
  • If nnn has no factors in the range n\sqrt nn​, then nnn must be prime, for if nnn did have a larger factor, nnn would also have a smaller factor we would have found.
❦
Newer ৪ Blog ৪ Older