Input
Enter a positive integer ≥ 2
Algorithm Comparison
| Algorithm | Complexity | Guarantees | Best for |
|---|---|---|---|
| Trial Division | O(√n) | Deterministic | Small numbers |
| Fermat's Test | O(k·log³n) | Probabilistic | Quick screening |
| Miller-Rabin | O(k·log³n) | Probabilistic | Cryptography |