next up previous
Next: Up: Previous:

Primality Testing

Finding large primes.

Density Of Primes

The prime distribution function $\pi$(n) specifies number of primes $\leq$ n.

Theorem 33.37 \(\stackrel{lim}{n \rightarrow \infty} \frac{\pi(n)}{n /ln n} \;=\; 1\)

\(\pi(n) \;\approx\; \frac{n}{ln n}\)

For example, \(\pi(10^9)\)$\approx$ 48,254,942.

The probability that randomly-chosen n is prime \(\approx\; \frac{1}{ln n}\). Thus, try \(\frac{lnn}{2}\) odd numbers near n to find a prime with high probability.

For example, 100-digit number
\(ln 10^{100} \;\approx\; 230\). Try 115 odd numbers near 10100.

About 1/230 100-digit numbers are prime.

Break input message M into numerical blocks smaller than n.

next up previous
Next: Up: Previous: