next up previous
Next: Up: Previous:

Trial Division

Try all odd numbers \(3, \ldots, \sqrt{n}\) to test n for primality.

Running Time \(\Theta(\sqrt{n})\), but \(\beta \;=\; \lceil lg(n+1) \rceil \;\longrightarrow\;
\sqrt{n} \;=\; \Theta(2^{\frac{\beta}{2}})\) (exponential).

This works well only for small n.


next up previous
Next: Up: Previous: