Prime Number Calculator

Test whether any number is prime, find its nearest primes, and list all primes up to a given target.

What is a Prime Number?

A prime number is a natural number greater than 1 that has exactly 2 distinct positive factors: 1 and itself. The first 10 prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. The number 2 is the only even prime number — every other even number is divisible by 2 and therefore composite.

There are 25 prime numbers below 100, 168 primes below 1,000, and 78,498 primes below 1,000,000. The Prime Number Theorem states the number of primes below n approximates n / ln(n). Prime numbers are the atoms of arithmetic — the Fundamental Theorem of Arithmetic guarantees every integer greater than 1 factors uniquely into primes.

How to Test if a Number is Prime

The Sieve of Eratosthenes eliminates composite numbers step by step. Watch it identify all 25 primes below 100.

Sieve of Eratosthenes

Click Run to start the sieve.

1
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
Prime Composite Current divisor

Frequently Asked Questions

No, 1 is not a prime number. By definition, a prime number must be greater than 1 and have exactly 2 distinct positive factors: 1 and itself. The number 1 has only 1 factor (itself), so 1 is classified as neither prime nor composite. Excluding 1 from prime numbers preserves the uniqueness of the Fundamental Theorem of Arithmetic.