p > 1 with divisors 1 and p only
Prime Number Checker & Generator
Miller-Rabin · sieve · factorization · Goldbach · twin primes · BigInt
BigInt
Miller-Rabin
Sieve
Goldbach
–
&
Algorithms reference
- Primality: Deterministic
Miller-Rabinfor 64-bit; probabilistic for BigInt. - Sieve:
Eratosthenesup-to-N; segmented for ranges. - Factorization: Trial division,
6k±1optimization. - Nth prime: PNT bound
n(ln n + ln ln n). - Goldbach: Sieve-based scan for even N.
- GCD: Euclidean algorithm (BigInt).
Result
—
Unique prime factorization
π(x) ~ x / ln(x)
Advertisement
About this prime calculator
Check if any integer is prime (Miller-Rabin with BigInt), generate primes via the Sieve of Eratosthenes, factorize into prime factors, find the Nth prime, locate the nearest prime, test Goldbach partitions, compute GCD, highlight twin primes, and visualize gaps and density. Use Math AI for number-theory tutoring or to solve related problems (∫, algebra, matrices) in chat with the same engines as other Math Studio tools.
FAQ
How does the primality test work?
Deterministic Miller-Rabin for 64-bit integers; probabilistic Miller-Rabin with strong witnesses for larger BigInt values.
What is the Sieve of Eratosthenes?
An algorithm that marks multiples of each prime starting from 2. Range queries use a segmented sieve for primes between A and B.
How large can the numbers be?
Primality and factorization support arbitrary BigInt. Sieve generation is capped at 2 million for browser performance.
How does factorization work?
Trial division with 6k±1 optimization after dividing out 2 and 3.