Free Prime Number Tool

Prime Number Calculator

Check whether a whole number is prime, see why, and explore related prime tools.

Examples:

97 is a Prime Number

Proven · Step-by-Step Check

✓ 97 is 100% Prime: no numbers divide into it evenly up to √97 — Has only 2 factors: 1 and itself

Prime Place
#25
Place on list
Previous Prime
89
Just below
Next Prime
101
Just above
Digits
2
Total digits
Factors & Breakdown
Smallest Prime Factor: 7
Prime Factors: 7 × 13
Total Factors: 4
Would you like to check the positive version of this number instead?
Show step-by-step division checks ▾

To check if a number is prime, you do not need to test every smaller number. You only need to test prime numbers up to its square root.

How It Works

How Our Prime Number Calculator Works

Built for speed, accuracy, and clear step-by-step explanations.

A prime number calculator is an easy-to-use tool that checks whether any whole number is prime or composite. It tests whether the number can be divided evenly by other numbers, finds its prime factors, and shows nearby prime numbers with clear explanations.

Interactive 3-Step Process

Click any step to see what happens:
1

Enter a Whole Number

Type any positive whole number into the box or pick one of our example numbers above.

2

Click Check Prime

The calculator checks if any smaller number divides into it evenly, using fast and proven math checks.

3

Read Your Result

See whether your number is prime or composite, with step-by-step division checks, prime factors, and nearby primes.

Explore Our Tools

Prime Number Tools

Easy-to-use calculators built to help you explore and solve prime number math.

Showing 25 of 25 tools
Lists & Ranges

Prime Generator

Create full lists of prime numbers in any range you choose, and easily copy the results.

Use Tool →
Check & Factors

Prime Factorisation

Break down composite numbers into their prime factors using simple step-by-step division ladders and factor trees.

Use Tool →
Lists & Ranges

Next & Previous Prime

Find the closest prime numbers just above and below your number, and see how far away they are.

Use Tool →
Lists & Ranges

Nth Prime

Find any prime by its exact position in the sequence, from the 1st prime (2) to the 10,000th prime (104,729).

Use Tool →
Σ
Lists & Ranges

Prime Sum

Add up all the prime numbers in any range you choose, with 100% exact math.

Use Tool →
Lists & Ranges

Primes Between

Find and count all the prime numbers between any two numbers, and see the gaps between them.

Use Tool →
Check & Factors

Coprime Checker

Check if two numbers share any common factors besides 1, with clear step-by-step division.

Use Tool →
π(x)
Charts & Visuals

Prime Counting π(x)

See how many primes exist up to any number, and discover how prime numbers thin out as numbers get bigger.

Use Tool →
Charts & Visuals

1–100 Prime Chart

Interactive 10×10 visual grid that shows how to find primes step by step, with a printable option.

Use Tool →
Charts & Visuals

Factor Tree Calculator

Interactive visual factor tree. Watch numbers branch step by step into their prime factors.

Use Tool →
Special & Crypto

Twin Prime Calculator

Find twin prime pairs (primes that differ by just 2, like 11 and 13) and see how often they appear.

Use Tool →
Lists & Ranges

Prime Gap Calculator

Find the distances between back-to-back prime numbers and spot large gaps.

Use Tool →
Charts & Visuals

Sieve of Eratosthenes

Interactive animated visualizer crossing off multiples step by step to reveal prime numbers.

Use Tool →
Check & Factors

Bulk Prime Checker

Check up to 500 numbers at the same time to see which are prime and export to CSV.

Use Tool →
Special & Crypto

Random Prime Generator

Generate truly random prime numbers with custom digit lengths.

Use Tool →
Charts & Visuals

Prime Number Theorem

Compare the exact count of prime numbers against famous mathematical estimation formulas.

Use Tool →
Special & Crypto

Goldbach Calculator

Find pairs of prime numbers that add up to any even number you choose.

Use Tool →
Check & Factors

Semiprime Calculator

Analyze numbers made by multiplying exactly two prime numbers together (like 15 = 3 × 5).

Use Tool →
Special & Crypto

Mersenne Prime Calculator

Test huge primes written as 2^p - 1 and explore world-record prime numbers.

Use Tool →
Check & Factors

Prime Power Calculator

Test if a number is a prime raised to a power (like 2³ = 8 or 3² = 9).

Use Tool →
Special & Crypto

Special Prime Checker

Explore fascinating prime families like palindrome primes, twin primes, and mirror primes.

Use Tool →
Charts & Visuals

Prime Distribution & Ulam Spiral

View prime numbers plotted on a visual 2D spiral to discover line patterns.

Use Tool →
Special & Crypto

RSA Prime Demo

Interactive visual demonstration of how prime numbers lock and protect secret messages online.

Use Tool →
Check & Factors

Fraction Prime Factorization

Break down fractions into prime factors and simplify them easily.

Use Tool →
Check & Factors

How to Check If a Number Is Prime

Simple algorithms and copyable code examples in Python, JavaScript, C++, Java, and Go.

Use Tool →
Prime Basics

What Is a Prime Number?

The basic building blocks of all numbers.

Interactive Visual: The Rectangle Test

A number is prime if you can only arrange its dots into a single straight line. If you can arrange them into a neat rectangle with two or more rows, it is composite.

Try Examples:
12 is Composite: 3 rectangular arrangements possible
Displaying a 3 × 4 rectangular array with zero remainder.

Definition and Examples

In math, a prime number is a positive whole number greater than 1 that has only two factors: 1 and itself. This means no other numbers divide into it evenly.

The first ten prime numbers are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.

Every whole number greater than 1 that is not prime is called a composite number, because it can be made by multiplying smaller prime numbers together.

Quick Integer Classifier (Tap 0, 1, 2, or Any Integer)
2 is the ONLY even prime — factors: 2 (exactly 2 divisors).
Indivisible emerald prime polyhedra beside a factored composite block
The Building Blocks of Arithmetic Like chemical elements in chemistry, prime numbers cannot break down further—every composite whole splits cleanly into a unique product of primes.

Why 0 and 1 Are Not Prime

0 is neither prime nor composite: It can be divided by any number without a remainder (0 ÷ 5 = 0), so it has endless factors. Also, prime numbers must be positive numbers greater than 1.

1 is neither prime nor composite: It has only one factor (itself). If 1 were counted as prime, every number could be broken down in endless different ways (such as 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3), which would break the basic rules of arithmetic.

Four classes of non-negative integers: 0, 1, primes, and composites

Classification map of whole numbers: 0 (zero divisors rule), 1 (unit), Primes (2 factors), and Composites (3+ factors).

Prime vs. Composite Numbers

A quick look at the simple differences between prime and composite numbers:

Feature Prime Numbers Composite Numbers
Definition Has only 2 factors: 1 and itself Has more than 2 factors
Number of Factors Exactly 2 factors 3 or more factors
Smallest Example 2 (the only even prime) 4 (2 × 2)
Prime Factors Just the number itself (p¹) Multiplied from prime factors (like 12 = 2² × 3)
Even Numbers Only 2 is prime; all other even numbers are composite All even numbers greater than 2 (4, 6, 8, 10, 12…)
Examples 2, 3, 5, 7, 11, 13, 97, 101 4, 6, 8, 9, 12, 51, 91, 100

Why 2 Is the Only Even Prime

An even number is any number you can divide by 2. The number 2 only has two factors (1 and 2), which makes it prime. But every larger even number can be divided by 1, 2, and itself, giving it at least three factors. Because it has extra factors, no even number greater than 2 can ever be prime.

Are 7 and 9 Prime Numbers?

7 is a prime number: Its only factors are 1 and 7. No other numbers multiply to 7. 9 is NOT a prime number: 9 can be divided evenly by 3 (3 × 3 = 9). It has three factors: 1, 3, and 9. Just because a number is odd does not mean it is prime!

Step-by-Step Guide

How to Check if a Number Is Prime

The square root shortcut and step-by-step methods.

Interactive Tool: The Square Root Shortcut

See how testing only up to the square root saves huge amounts of time when checking for prime numbers.

Try Test Cases:
Square Root Cutoff
√97 ≈ 9.85
p ≤ 7 (⌊√97⌋ = 9)
Primes to Test
4
2, 3, 5, 7
Tests Saved
92
92 / 96 (95.8%)
Search Horizon Visualization (1 → ⌊√n⌋ → n) Only prime divisors ≤ ⌊√n⌋ are needed

Division Checks up to √n

Multi-stage lattice filter separating composite numbers from emerald prime values
Eliminating Multiples Early Small prime filters (2, 3, 5, 7…) sift out composites immediately, shrinking candidate tests up to √N.
Geometry explaining why factor pairs mirror around square root of n
Why √N Is the Exact Cutoff Every factor pair (a × b = n) has one member ≤ √n and the mirror cofactor ≥ √n.

The Square Root Shortcut

To check if a number is prime, you do not need to test every smaller number. You only need to test prime numbers up to its square root.

Why this works: Factors always come in pairs (a × b = n). If both factors were bigger than the square root, multiplying them would make a number larger than n. So if a number has any factors, at least one of them must be equal to or smaller than its square root.

Worked Example: Is 97 Prime?

  1. Find √97 ≈ 9.8. We only need to test prime numbers up to 9.
  2. The primes to test are: 2, 3, 5, and 7.
  3. 97 ÷ 2 = 48 remainder 1 (Does not divide evenly, ends in odd digit 7).
  4. 97 ÷ 3 = 32 remainder 1 (Does not divide evenly, digits 9+7=16 is not divisible by 3).
  5. 97 ÷ 5 = 19 remainder 2 (Does not divide evenly, does not end in 0 or 5).
  6. 97 ÷ 7 = 13 remainder 6 (Does not divide evenly).
  7. None of the primes up to √97 divided into 97 evenly. Therefore, 97 is 100% prime!

Worked Example: Why Is 91 Composite?

  1. Find √91 ≈ 9.5. We only need to test prime numbers up to 9.
  2. The primes to test are: 2, 3, 5, and 7.
  3. 91 ÷ 2 = 45 remainder 1 (Does not divide evenly).
  4. 91 ÷ 3 = 30 remainder 1 (Does not divide evenly, digits 9+1=10).
  5. 91 ÷ 5 = 18 remainder 1 (Does not divide evenly, does not end in 0 or 5).
  6. 91 ÷ 7 = 13 remainder 0 (Divides evenly!).
  7. Since 7 divides into 91 evenly, 91 is a composite number: 91 = 7 × 13.

Mental Math Shortcuts

You can quickly spot composite numbers in your head using these simple rules:

  • Divisible by 2: The last digit is even (0, 2, 4, 6, 8).
  • Divisible by 3: The digits add up to a multiple of 3 (for example, for 51: 5+1=6, so 51 ÷ 3 = 17).
  • Divisible by 5: The last digit is 0 or 5.
  • The 6k ± 1 rule: Every prime number greater than 3 is either 1 less or 1 more than a multiple of 6 (like 5, 7, 11, 13, 17, 19). If a number isn't next to a multiple of 6, it cannot be prime!
Mental Math Shortcuts

Divisibility Rules & Shortcuts

Simple mental rules to quickly tell if a number can be divided evenly without using a calculator.

Interactive Visual: The Multiple-of-6 Rule

Every prime number greater than 3 is always next to a multiple of 6 (either one less or one more).

Try Examples:
6k 6k+1 ★ 6k+2 6k+3 6k+4 6k−1 ★ DIV BY 6
The Multiple-of-6 Shortcut (6k ± 1)
97 = 6 × 16 + 1
Remainder dividing by 6: 1 → 6k + 1
Interactive Divisibility Scanner (Test Any Number Against All 10 Rules) Testing 2,730 — divisible by 2, 3, 5, 6, 7, 13 (6 rules match).
Number Rule to Check Example Live Result
2 The last digit is even: 0, 2, 4, 6, or 8. 248 ends in 8 → Divisible by 2
3 The sum of all individual digits can be divided by 3. 453 → 4+5+3 = 12 (divisible by 3) → Divisible by 3
4 The number formed by the last two digits can be divided by 4. 3,116 ends in 16 (16 ÷ 4 = 4) → Divisible by 4
5 The last digit is either 0 or 5. 895 ends in 5 → Divisible by 5
6 The number passes both the 2 test (even) and the 3 test (digits add to a multiple of 3). 732 is even and 7+3+2 = 12 → Divisible by 6
7 Double the last digit and subtract it from the rest. The result divides by 7. 672 → 67 − (2×2) = 63 (63 ÷ 7 = 9) → Divisible by 7
8 The number formed by the last three digits can be divided by 8. 5,128 ends in 128 (128 ÷ 8 = 16) → Divisible by 8
9 The sum of all individual digits can be divided by 9. 2,871 → 2+8+7+1 = 18 (18 ÷ 9 = 2) → Divisible by 9
11 The alternating sum of digits (add-subtract-add...) is 0 or a multiple of 11. 913 → 9 − 1 + 3 = 11 → Divisible by 11
13 Add 4 times the last digit to the remaining number. The result divides by 13. 299 → 29 + (9×4) = 65 (65 ÷ 13 = 5) → Divisible by 13

The Multiple-of-6 Shortcut (6k ± 1)

Every prime number greater than 3 is always next to a multiple of 6 (either one less or one more).

6k − 1  |  6k + 1

Why this always works: Every whole number falls into one of six patterns around multiples of 6: 6k, 6k+1, 6k+2, 6k+3, 6k+4, or 6k+5 (which is 6k−1).

  • 6k, 6k+2, and 6k+4 are always even numbers, so they can be divided by 2.
  • 6k+3 can always be divided by 3.

Helpful Note: This rule helps narrow things down, but not every number of this form is prime. For example, 25 (24+1) and 35 (36−1) fit the pattern, but both can be divided by 5. Always check with division.

Why There Is No Simple Formula for Primes

In 1772, mathematician Leonhard Euler discovered a famous formula, n² + n + 41, that produces 40 prime numbers in a row (41, 43, 47, 53, 61, ..., up to 1,601).

f(n) = n² + n + 41

However, at n = 40, the formula gives 40² + 40 + 41 = 1,681 = 41 × 41. Mathematicians have proven that no single algebraic formula can produce only prime numbers forever.

Click any n (0–45) to verify f(n): f(0) = 41 (Prime)
Visual Grid Reference

1 to 100 Prime Number Chart

Interactive 10×10 visual grid. Watch how composite numbers are eliminated step by step.

Prime Numbers (1–100) Σ = 1,060
Click "Step 1" to see how ancient mathematician Eratosthenes crossed out composite numbers! Step 0/4
Prime (25 numbers: 2, 3, 5, 7, 11, … 97)
Composite (74 numbers: multiples of tested primes)
Neither (1) (1 only has 1 factor)
Step through the ancient method: cross off multiples of 2, 3, 5, and 7 to reveal all 25 prime numbers.
Full List

Prime Numbers from 1 to 1,000

There are exactly 168 prime numbers between 1 and 1,000.

Interactive Diagram: Primes Across Groups of 100

Click any bar below to view the primes in that group of 100.

Showing 168 prime numbers (1 to 1000) (Σ = 76,127)
View All 168 Prime Numbers Up to 1,000 ▾

Click any prime below to check it in the calculator.

Showing 168 prime numbers (2 to 997)
Prime Milestones

Key Prime Milestones

Notable prime numbers that mark important landmarks as numbers grow.

Notable Milestones:
Interactive Nth Prime Finder & Growth Chart p(100) = 541 · 100 × ln(100) ≈ 461
Exact p(n) n · ln(n)
Prime Number
541
p(100)
Nearby Primes
p₉₉: 523 · p₁₀₁: 547
p(n−1) · p(n+1)
Prime Place
#100
Official Prime Sequence

Key Prime Milestones

These benchmark primes mark important landmarks as numbers grow larger:

#1 → 2

p₁ = 2

The smallest prime number, and the only even prime number in existence. All other prime numbers are odd.

#25 → 97

p₂₅ = 97

The largest two-digit prime number. Exactly 25 prime numbers live between 1 and 100.

#100 → 541

p₁₀₀ = 541

The 100th prime number. About 18.5% of all numbers up to 541 are prime numbers.

#1,000 → 7,919

p₁₀₀₀ = 7,919

The 1,000th prime number. Shows that primes become rarer as numbers get bigger: it takes numbers up to 7,919 to reach 1,000 primes (12.6% are prime).

#5,000 → 48,611

p₅₀₀₀ = 48,611

The 5,000th prime number. Sits just beneath 50,000, where roughly 10.3% of numbers are prime.

#10,000 → 104,729

p₁₀₀₀₀ = 104,729

The 10,000th prime milestone. Our lookup tool finds any prime up to this mark instantly.

Prime Counting

How Many Primes Exist? (Prime Counting)

See how many primes exist up to any number, and discover why primes appear less often as numbers get bigger.

Preset Limits:
Interactive Prime Counter & Percentage Meter Prime Percentage: 16.80% (~1/6)
0% 25% (x=100) 50% 100%
Exact Prime Count
168
Primes up to this number (≤ 1,000)
Prime Percentage
16.80%
Percentage of numbers that are prime
Estimated Count
144.76
Difference (%): −13.8%

Prime Counts and Percentages by Powers of 10

As numbers get bigger, prime numbers appear less often, though they go on forever. Notice how the estimated formula gets closer to the real count as numbers grow:

Up to Number (x) Exact Primes Found Prime Percentage (%) Estimated Count Difference (%)
10 4 40.00% 4.34 +8.5%
100 25 25.00% 21.71 −13.1%
1,000 168 16.80% 144.76 −13.8%
10,000 1,229 12.29% 1,085.74 −11.7%
100,000 9,592 9.59% 8,685.89 −9.4%
1,000,000 78,498 7.85% 72,382.41 −7.8%
10,000,000 664,579 6.65% 620,420.69 −6.6%
100,000,000 5,761,455 5.76% 5,428,681.02 −5.8%

What Does π(x) Mean?

In prime math, π(x) does not mean the circle number 3.14159. Instead, mathematicians use the Greek letter π (pi) as a shorthand for 'count of primes up to x'. For example, π(10) = 4, because there are 4 primes up to 10: 2, 3, 5, and 7.

Every time you pass a prime number, this count simply goes up by 1.

The Prime Number Theorem

Proven in 1896, this famous math theorem shows that as numbers grow, the count of prime numbers follows an easy formula based on logarithms:

π(x) ~ x / ln(x)

This theorem reveals that the chance of a random number near x being prime is roughly 1 divided by the natural logarithm of x (written as 1 / ln(x)).

Comparison chart of exact prime count pi(x), logarithmic integral Li(x), and x/ln(x)
Exact π(x) vs Gauss’s Li(x) vs x/ln(x) As upper bound x grows toward 10⁸, prime density smoothly thins like 1/ln(x) while Gauss’s logarithmic integral Li(x) hugs the true count far more closely than x/ln(x).
Range Finder

Find Prime Numbers in a Range

Find, count, and calculate the exact total sum of primes between any two numbers.

Presets:
Find Prime Numbers in a Range Prime Percentage: 25.0%
Density Histogram (10 bins) Prime Position Twin Prime Pair (Δ = 2)
Prime Count
25
π(end) − π(start−1)
Total Sum
1,060
Exact total sum
First & Last Primes
2 … 97
Start and end numbers
Nearby Primes

Find the Next and Previous Prime

Find the closest prime numbers just above and below your number, and see how far away they are.

Try Examples:
Interactive Prime Jump Line 89 (Δ = 1)
n: 90
Previous Prime (p < n)
89
Δ = −1
n
90
Proven Composite
Next Prime (p > n)
97
Δ = +7
Nearest Prime 89 (Δ = 1)
max(p ≤ n) 89
Use Tool →

Strict Neighbors vs. Including Your Number

When searching for nearby primes, you can look for primes strictly above or below your number, or include your number if it is already prime:

  • Previous Prime: The largest prime smaller than your number. For 97, the previous prime is 89.
  • Next Prime: The smallest prime bigger than your number. For 97, the next prime is 101.
  • Largest Prime Up to n: If your number is already prime (like 97), the answer is 97. If it is composite (like 90), the answer is 89.

Bertrand's Rule & Equal Distance Ties

How far away can the next prime be? A famous math rule proven in 1850 shows that for any number greater than 3, there is always at least one prime between that number and double its value (between n and 2n).

n < p < 2n − 2

Equal Distances: Sometimes the previous and next primes are the exact same distance away! For example, for 6, the previous prime is 5 (1 step away) and the next is 7 (1 step away). Both are equally close!

Step-by-Step Breakdown

Prime Factorisation with Steps

See how any composite number breaks down into prime factors.

Interactive Factor Tree & Division Ladder

Enter any whole number to see both a visual factor tree and step-by-step division steps.

Try Examples:
Prime Factor Powers
360 = 2³ × 3² × 5
Common Factors & GCF

Coprime Number Checker

Check whether two numbers share any common factors other than 1 using easy step-by-step division.

Try Number Pairs:
✓ (8, 9) — ARE COPRIME (Share no common factors besides 1)
gcd(8, 9) = 1
Greatest Common Factor 1
Interactive Visual: Square Tile Fitting Largest common tile: 1 × 1

Ancient mathematician Euclid discovered that finding the greatest common factor is just like finding the largest square tile that can completely cover a rectangle without any gaps or overlapping:

Step-by-Step Division Steps

9 = 8 × 1 + 1
8 = 1 × 8 + 0

Can Two Composite Numbers Be Coprime?

Yes, absolutely! Two numbers are coprime (also called relatively prime) if their greatest common factor is 1, even if neither number is prime on its own.

gcd(a, b) = 1

For example, look at 8 and 9. Neither number is prime! (8 = 2 × 2 × 2 and 9 = 3 × 3). But because they do not share any factors with each other, their greatest common factor is 1, which makes them coprime.

Where Coprime Numbers Are Used

  • Counting Shared Factors: Mathematicians count how many numbers up to a number share no common factors with it.
  • Computer Security: Internet encryption systems pick coprime numbers to create secure digital locks and keys.
  • Data Storage: Computer programs use coprime numbers to spread saved data evenly and avoid slowdowns.
Tricky Numbers

Numbers That Look Prime but Aren't

Tricky composite numbers that frequently fool students, programmers, and puzzle solvers.

Interactive Inspector: False Prime Breakdown

Why 91 Fools Almost Everyone

91 = 7 × 13
√91 ≈ 9.54 (p ≤ 7)

Why These Numbers Fool Us

91 ends in 1, so it isn't even. Its digits add up to 10, so it can't be divided by 3. And it doesn't end in 5. Because 7 × 13 isn't something most people memorize in school multiplication tables, our brains naturally assume 91 must be prime!

51 Composite
3 × 17
5 + 1 = 6 (÷ 3 → 51 = 3 × 17)
Click to see factors ↓
57 Composite
3 × 19
5 + 7 = 12 (÷ 3 → 57 = 3 × 19)
Click to see factors ↓
91 Composite
7 × 13
91 ends in 1, so it isn't even. Its digits add up to 10, so it can't be divided by 3. And it doesn't end in 5. Because 7 × 13 isn't something most people memorize in school multiplication tables, our brains naturally assume 91 must be prime!
Click to see factors ↓
119 Composite
7 × 17
119 ÷ 7 = 17 (6k − 1)
Click to see factors ↓
133 Composite
7 × 19
133 ÷ 7 = 19 (6k + 1)
Click to see factors ↓
143 Composite
11 × 13
1 − 4 + 3 = 0 (÷ 11 → 11 × 13)
Click to see factors ↓
161 Composite
7 × 23
161 ÷ 7 = 23 (6k − 1)
Click to see factors ↓
221 Composite
13 × 17
221 ÷ 13 = 17 (6k − 1)
Click to see factors ↓
247 Composite
13 × 19
247 ÷ 13 = 19 (6k + 1)
Click to see factors ↓
289 Composite
17² (17 × 17)
√289 = 17 (17 × 17 = 289)
Click to see factors ↓
323 Composite
17 × 19
18² − 1 = (18−1)(18+1) = 17 × 19
Click to see factors ↓
Why do these fool us? 91 ends in 1, so it isn't even. Its digits add up to 10, so it can't be divided by 3. And it doesn't end in 5. Because 7 × 13 isn't something most people memorize in school multiplication tables, our brains naturally assume 91 must be prime!
Special Prime Families

Special Types of Prime Numbers

Explore unique families of prime numbers with fascinating patterns.

Geometric prime constellation spiral illuminating special prime classes
Special Families Inside the Prime Constellation Some primes carry extra symmetry—differing by 2 (Twins), sitting at 2ᵖ − 1 (Mersenne), reading identically backward (Palindromic), or remaining prime when reversed (Emirps).

Quick Special-Prime Scanner

Test any prime to see every special mathematical family it belongs to simultaneously.

Special Prime Families

Explore unique families of prime numbers with fascinating patterns.

Twin Primes

Pairs of prime numbers that are separated by just 2 numbers: (p, p + 2). Mathematicians believe there are infinitely many of these pairs, but nobody has been able to prove it yet!

Examples: (3, 5), (5, 7), (11, 13), (17, 19), (41, 43), (71, 73)

Mersenne Primes

Primes that can be written as 2 raised to a power minus 1 (2ᵖ − 1). These include the largest known prime numbers in the world.

Examples: 3 (2²−1), 7 (2³−1), 31 (2⁵−1), 127 (2⁷−1), 8,191 (2¹³−1)

Sophie Germain Primes

A prime number p where doubling it and adding 1 (2p + 1) also gives a prime number. These are useful in computer security.

Examples: 2 (2×2+1=5), 3 (7), 5 (11), 11 (23), 23 (47), 29 (59)

Palindrome Primes

A prime number that reads the exact same forwards and backwards (like 131 or 727). Except for 11, all palindrome primes have an odd number of digits!

Examples: 2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 727
Behind the Scenes

How Our Calculator Works

Clear, verified math methods with 100% honest results.

Interactive Flowchart: Step-by-Step Math Engine

Follow the exact steps our tool uses to check any whole number.

Try Test Cases:
Step 1: Check Input
Checking that your input is a whole number
Whole Number (n ≥ 0)
Step 2: Fast Quick Checks
Multiple-of-6 Rule
Fast test for 2, 3, and 5
Step 3: Factor Testing
Testing if any smaller numbers divide into it
Instant list check
Step 4: Show Results
Proven Prime
100% Proven (0% Error)
n = 97 → #25 → Proven Prime
Decision tree showing sieve lookup, 6k+/-1 trial division, and 7-base Miller-Rabin routing
Adaptive Primality Decision Tree Inputs automatically route to the fastest deterministic check: instant sieve lookup (≤105,000), 6k ± 1 trial division (≤10¹²), or 7-base Miller-Rabin (≤2⁶⁴−1).
Step-by-step Miller-Rabin modular exponentiation squaring flowchart
7-Base Deterministic Verification Flow Unlike single-base Fermat tests that fail on Carmichael numbers like 561, testing all 7 verified bases eliminates every 64-bit pseudoprime without false positives.

Everyday Numbers: Step-by-Step Division

For normal numbers, the calculator tests factors up to the square root using smart shortcuts. If no number divides in evenly, the number is 100% proven prime.

Range Lists: Prime Grid Sieve

To find all primes in a range, our tool uses the ancient Sieve method, quickly crossing off multiples of each prime to reveal the primes left behind.

Giant Numbers: Advanced Prime Checks

For huge numbers up to 18 quintillion, our tool runs proven mathematical tests (the Miller-Rabin test across 7 certified bases) to guarantee 100% certainty with zero guesswork.

Exact BigInt Math

Normal web calculators make rounding mistakes when numbers get too big. Our calculator uses special exact-math technology (BigInt) so every single digit is 100% accurate.

Tool / Action Math Method Used Tested Range Result Accuracy
Check Prime Square root check & advanced prime test Numbers up to 18 quintillion 100% Proven (0% Error)
Prime Factors Step-by-step division test Numbers up to 1 trillion 100% Proven (0% Error)
Nth Prime Fast prime sequence lookup Up to the 10,000th prime (104,729) 100% Proven (0% Error)
Primes in Range Prime grid sieve Ranges up to 10,000 numbers 100% Proven (0% Error)
Real-World Uses

Why Prime Numbers Matter

Beyond math class, prime numbers protect internet security and power modern technology.

Interactive Visual: How Primes Lock Secret Messages (RSA Demo)

See how multiplying two prime numbers creates a one-way digital lock that protects information online.

1. Two Secret Primes
p = 5, q = 7
Kept strictly private
2. Public Lock Number
n = p × q = 35
Easy to calculate
3. Security Key Formula
(5−1) × (7−1) = 24
(p−1) × (q−1)
4. Digital Key Pair
(e = 5, d = 5)
Matching lock and key
Lock and unlock secret numbers
Locked Secret Message
12 locked with key → 17
Unlocked Original Message
17 unlocked with key → 12 ✓
Learning Demonstration: This example uses small prime numbers so you can see the math clearly. Real computer security uses huge primes with hundreds of digits!
Translucent indigo padlock secured by interlocking prime factor gears
One-Way Prime Trapdoor Encryption Multiplying two huge secret primes (p × q = N) takes microseconds, while factoring N backward without the key becomes astronomically difficult.

Interactive RSA Key Scale Explorer

Compare toy classroom locks with modern banking encryption scales:

6-bit Toy Modulus (~11 bits) Instant Break

Educational demonstration above uses small numbers (like 35) so every exponent step is visible by hand.

Prime numbers are often called the 'building blocks of math' because every whole number can be made by multiplying prime numbers together. Because multiplying primes is easy, but untangling them is very hard, primes are the secret backbone of digital security.

Internet Security & Passwords

When you log into a website or send a secure payment, prime numbers protect your data. It's easy for computers to multiply two large primes, but nearly impossible for hackers to break them back apart.

Fast Computer Search

Databases and search engines use prime numbers to distribute stored information evenly across computer memory, avoiding clumping and keeping searches fast.

Math Mysteries

Prime numbers hold some of the most famous unsolved mysteries in science, challenging researchers to understand the patterns hidden within numbers.

Accuracy & Testing

Accuracy, Verification & Limits

Tested math methods, exact calculations, and complete transparency.

Balanced mathematical scales flanked by brass divider compass and optical lens
Zero Rounding, Zero Probabilistic Shortcuts Every primality check uses exact arbitrary-precision BigInt integer arithmetic paired with verified deterministic bounds up to 2⁶⁴ − 1.

Live Browser Engine Self-Test

Verify engine.js directly in your browser against adversarial pseudoprimes, boundaries, and numbers above IEEE-754 float precision.

Click "Run 8 Edge Cases Now" to run live verification.
✓

100% Proven Prime Guarantee

For all numbers up to 18 quintillion, our calculator uses certified mathematical tests proven by mathematicians. Our tests are real mathematical proofs with 0% chance of error.

#

No Rounding Mistakes

Many online calculators make rounding errors on large numbers. We use exact-digit math (BigInt) so that every single digit is preserved without rounding.

⚙

Thoroughly Tested

Every update to our calculator is checked against thousands of known prime numbers, tricky numbers that fool basic tests, and verified math tables to ensure 100% accuracy.

Math Sources & References

  • Crandall, R., & Pomerance, C. (2005): Prime Numbers: A Computational Perspective. 2nd ed., Springer-Verlag. (Standard reference on prime testing algorithms).
  • Sorenson, J., & Webster, J. (2015): Strong Pseudoprimes to Twelve Prime Bases. Mathematics of Computation, 85(301), pp. 2489–2503.
  • OEIS: The On-Line Encyclopedia of Integer Sequences (OEIS): Sequence A000040: The Prime Numbers.
  • GIMPS: Great Internet Mersenne Prime Search (GIMPS): Official tracker for world-record largest known primes. (2¹³⁶²⁷⁹⁸⁴¹ − 1).
  • CP-Algorithms: CP-Algorithms: Certified Miller-Rabin Primality Testing.
Calculator Math Verification: Fully Tested & Benchmarked Read Our Full Math Methodology →
Common Questions

Frequently Asked Questions

Simple, clear answers to common questions about prime numbers.

9 questions
What is a prime number?

A prime number is a whole number greater than 1 that can only be divided evenly by 1 and itself. Common examples include 2, 3, 5, 7, 11, 13, and 97.

Why are 0 and 1 not considered prime numbers?

To be a prime number, a number must have exactly two factors: 1 and itself. The number 1 only has one factor (1), so it cannot be prime. The number 0 can be divided by any number without a remainder, so it has endless factors.

Why is 2 the only even prime number?

Every even number greater than 2 can be divided by 2, meaning it has at least three factors (1, 2, and itself). For example, 4 = 2 × 2 and 6 = 2 × 3. Because 2 only has two factors (1 and 2), it is the only even number that is prime.

Are 7 and 9 both prime numbers?

No. 7 is prime because only 1 and 7 divide into it evenly. But 9 is not prime because 3 × 3 = 9. It has three factors: 1, 3, and 9.

How do you check if a large number is prime?

For smaller numbers, you only need to test prime factors up to the number's square root. For very large numbers, computers use fast, proven mathematical checks to verify whether a number has any factors, giving a 100% exact result.

What is the largest prime number?

There is no single largest prime number because prime numbers go on forever. However, the largest prime number discovered so far by researchers is 2^136,279,841 − 1, which has over 41 million digits.

What are coprime (relatively prime) numbers?

Two numbers are coprime if they do not share any factors other than 1. Neither number has to be prime on its own. For example, 8 and 9 are both composite numbers, but because their only shared factor is 1, they are coprime.

How many prime numbers exist between 1 and 100?

There are exactly 25 prime numbers between 1 and 100: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, and 97. Added together, their sum is 1,060.

How does prime factorization work on a Casio fx-991ES calculator?

On models like the Casio fx-991ES PLUS or fx-115ES PLUS, type your number, press [=], then press [SHIFT] followed by the [FACT] key. The screen will show the prime factors.