Prime Lab

Primes are the atoms of arithmetic β€” every whole number is built by multiplying them together, in exactly one way. Break numbers into their prime pieces, find what numbers share, hunt for the next prime, and see the strange patterns primes make.

πŸ”Ž Prime explorer
βœ‰οΈ Email

Check any number for primality (this works even on giant numbers), and jump to the primes on either side.

1,000,000,007 is prime
🧬 Prime factorizer
βœ‰οΈ Email

Every number splits into a unique product of primes. Type one in.

360 = 23 Γ— 32 Γ— 5
6 prime factors (3 distinct)
24 divisorsdivisors sum to 1,170totient Ο† = 96abundant number
πŸ”— Greatest common divisor & least common multiple
βœ‰οΈ Email

The GCD is the biggest number that divides both; the LCM is the smallest number both divide into.

&
GCD
12
LCM
720
πŸ”¬ Everything about a number
βœ‰οΈ Email

Type any number and find out what kinds of special number it is.

perfectIt exactly equals the sum of all its smaller divisors: 1 + 2 + 4 + 7 + 14 = 28. Perfect numbers are incredibly rare β€” only a handful are known!
triangularDots pile into a triangle: 1 + 2 + 3 + … + 7 = 28 (think bowling pins or a rack of billiard balls).
happySquare each digit and add them up, again and again, and you land on 1: 28 β†’ 68 β†’ 100 β†’ 1. (Numbers that get stuck in a loop instead are called "sad.")
not: prime Β· abundant Β· deficient Β· square Β· cube Β· Fibonacci Β· power of 2 Β· palindrome
βž• Goldbach pairs
βœ‰οΈ Email

A 280-year-old unsolved puzzle: every even number bigger than 2 seems to be the sum of two primes. Try to break it.

100 = 3 + 97
🎒 Collatz: the 3n + 1 game
βœ‰οΈ Email

Pick a number. If it's even, halve it; if it's odd, triple it and add 1. Repeat forever… except every number ever tried eventually crashes down to 1. No one has proved it always will.

111 steps Β· peaks at 9,232
27 β†’ 82 β†’ 41 β†’ 124 β†’ 62 β†’ 31 β†’ 94 β†’ 47 β†’ 142 β†’ 71 β†’ 214 β†’ 107 β†’ 322 β†’ 161 β†’ 484 β†’ 242 β†’ 121 β†’ 364 β†’ 182 β†’ 91 β†’ 274 β†’ 137 β†’ 412 β†’ 206 β†’ 103 β†’ 310 β†’ 155 β†’ 466 β†’ 233 β†’ 700 β†’ 350 β†’ 175 β†’ 526 β†’ 263 β†’ 790 β†’ 395 β†’ 1186 β†’ 593 β†’ 1780 β†’ 890 β†’ 445 β†’ 1336 β†’ 668 β†’ 334 β†’ 167 β†’ 502 β†’ 251 β†’ 754 β†’ 377 β†’ 1132 β†’ 566 β†’ 283 β†’ 850 β†’ 425 β†’ 1276 β†’ 638 β†’ 319 β†’ 958 β†’ 479 β†’ 1438 β†’ 719 β†’ 2158 β†’ 1079 β†’ 3238 β†’ 1619 β†’ 4858 β†’ 2429 β†’ 7288 β†’ 3644 β†’ 1822 β†’ 911 β†’ 2734 β†’ 1367 β†’ 4102 β†’ 2051 β†’ 6154 β†’ 3077 β†’ 9232 β†’ 4616 β†’ 2308 β†’ 1154 β†’ 577 β†’ 1732 β†’ 866 β†’ 433 β†’ 1300 β†’ 650 β†’ 325 β†’ 976 β†’ 488 β†’ 244 β†’ 122 β†’ 61 β†’ 184 β†’ 92 β†’ 46 β†’ 23 β†’ 70 β†’ 35 β†’ 106 β†’ 53 β†’ 160 β†’ 80 β†’ 40 β†’ 20 β†’ 10 β†’ 5 β†’ 16 β†’ 8 β†’ 4 β†’ 2 β†’ 1
πŸͺœ Sieve of Eratosthenes
βœ‰οΈ Email

The oldest recipe for finding primes: write out the numbers, then cross out every multiple of 2, then 3, then 5… whatever survives is prime.

up to120
30 primes up to 120
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
πŸ“ˆ Counting the primes (Gauss & Riemann)
βœ‰οΈ Email

How many primes are below a number? There's no simple formula β€” but Gauss and Riemann found an astonishingly close estimate, li(x). Climb the powers of ten and watch the error shrink; the famous Riemann Hypothesis is really a question about how tiny it stays forever. (Past ten million we use mathematicians' record-breaking exact counts β€” no computer could ever list that many primes one by one.)

…or jump straight to a power of ten β€” each button is a 1 followed by that many zeros, so every step is 10Γ— bigger than the last.
primes below 106 β€” that's 1,000,000, a million (counted live, one by one)
the exact count
78,498
Riemann's estimate
78,628
off by just 130
the simpler estimate
72,382
off by 6,116
Riemann's estimate is off by only 0.166% β€” about 1 in 604 β€” and the bigger you go, the better it gets.
πŸŒ€ The Ulam spiral
βœ‰οΈ Email

Write the whole numbers in a square spiral starting from the center, then light up only the primes. They shouldn't line up… but they stubbornly fall along diagonal streaks. Nobody fully understands why.

Grid
8,100 numbers Β· showing every prime up to 8,100

More number toys

Jump into another calculator.