🌐 Universal Mathematics 🔐 RSA Cryptography 📋 Sieve of Eratosthenes 🧮 Prime Factorization

Prime Number Calculator

Check if a number is prime, list all primes up to N using the Sieve of Eratosthenes, or find the prime factorization of any number. Works up to 1 trillion for primality checks.

Quick Answer
A prime has exactly 2 factors: 1 and itself. 2 is the only even prime. 1 is NOT prime. First primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47. Every integer ≥ 2 has a unique prime factorization (Fundamental Theorem of Arithmetic).
Primality Algorithm Method Speed Used In
Trial Division Test divisors up to √nSlow for large nSchool curricula worldwide
Sieve of Eratosthenes Eliminate composites up to NFast for small N (< 10⁶)Generating lists of primes
Miller-Rabin (probabilistic) Witness-based randomized testVery fast, may have errorsRSA key generation (OpenSSL)
AKS Primality Test Deterministic polynomial-timeTheoretically optimalCryptography research
Elliptic Curve Primality Proves primality for large nPractical for very large nNIST / IETF standards

Frequently Asked Questions

Why is 1 not considered a prime number?

By modern mathematical convention, 1 is excluded from primes because including it would break the Fundamental Theorem of Arithmetic (every integer ≥ 2 has a unique prime factorization). If 1 were prime, 12 could be factored as 2²×3, or 1×2²×3, or 1×1×2²×3, giving infinitely many factorizations. The exclusion of 1 preserves uniqueness. Historically, some mathematicians (including Euclid) did consider 1 prime, but modern number theory standardised the definition around 1900. This is the same convention taught in all countries today.

How large are the primes used in real cryptography?

RSA-2048 (the current standard): uses two random prime numbers each with about 617 decimal digits (1,024 bits each). Their product (the public key modulus) has 2,048 bits. RSA-4096: primes of ~1,234 digits. Factoring a 2,048-bit number with current computers would take longer than the age of the universe. Quantum computers (if sufficiently large) could break RSA using Shor's algorithm — which is why post-quantum cryptography standards (NIST FIPS 203/204, 2024) are based on lattice problems instead of prime factorization. Used by GCHQ (UK), NSA (US), and all major banks and governments worldwide.