Wolfram.com
WolframAlpha.com
WolframCloud.com
Wolfram Language
Example Repository
Ready-to-use examples of the Wolfram Language
Primary Navigation
Categories
Astronomy
Audio Processing
Calculus
Cellular Automata
Chemistry
Complex Systems
Computer Science
Computer Vision
Control Systems
Creative Arts
Data Science
Engineering
Finance & Economics
Finite Element Method
Food & Nutrition
Geography
Geometry
Graphs & Networks
Image Processing
Life Sciences
Machine Learning
Mathematics
Optimization
Physics
Puzzles and Recreation
Quantum Computation
Signal Processing
Social Sciences
System Modeling
Text & Language Processing
Time-Related Computation
Video Processing
Visualization & Graphics
Alphabetical List
Submit a New Resource
Learn More about
Wolfram Language
Related Pages
Related Symbols
Prime
PrimePi
PrimeQ
Discovering Prime Numbers
Example Notebook
Open in Cloud
Download Notebook
Make a multiplication table:
I
n
[
1
]
:
=
T
a
b
l
e
[
a
*
b
,
{
a
,
2
,
1
0
}
,
{
b
,
2
,
1
0
}
]
/
/
G
r
i
d
O
u
t
[
1
]
=
4
6
8
1
0
1
2
1
4
1
6
1
8
2
0
6
9
1
2
1
5
1
8
2
1
2
4
2
7
3
0
8
1
2
1
6
2
0
2
4
2
8
3
2
3
6
4
0
1
0
1
5
2
0
2
5
3
0
3
5
4
0
4
5
5
0
1
2
1
8
2
4
3
0
3
6
4
2
4
8
5
4
6
0
1
4
2
1
2
8
3
5
4
2
4
9
5
6
6
3
7
0
1
6
2
4
3
2
4
0
4
8
5
6
6
4
7
2
8
0
1
8
2
7
3
6
4
5
5
4
6
3
7
2
8
1
9
0
2
0
3
0
4
0
5
0
6
0
7
0
8
0
9
0
1
0
0
Find all the numbers that occur in the table:
I
n
[
2
]
:
=
U
n
i
o
n
[
F
l
a
t
t
e
n
[
T
a
b
l
e
[
a
*
b
,
{
a
,
2
,
1
0
}
,
{
b
,
2
,
1
0
}
]
]
]
O
u
t
[
2
]
=
{
4
,
6
,
8
,
9
,
1
0
,
1
2
,
1
4
,
1
5
,
1
6
,
1
8
,
2
0
,
2
1
,
2
4
,
2
5
,
2
7
,
2
8
,
3
0
,
3
2
,
3
5
,
3
6
,
4
0
,
4
2
,
4
5
,
4
8
,
4
9
,
5
0
,
5
4
,
5
6
,
6
0
,
6
3
,
6
4
,
7
0
,
7
2
,
8
0
,
8
1
,
9
0
,
1
0
0
}
Find numbers from the first 100 don't occur in the multiplication table:
I
n
[
3
]
:
=
C
o
m
p
l
e
m
e
n
t
[
R
a
n
g
e
[
1
0
0
]
,
U
n
i
o
n
[
F
l
a
t
t
e
n
[
T
a
b
l
e
[
a
*
b
,
{
a
,
2
,
5
0
}
,
{
b
,
2
,
5
0
}
]
]
]
]
O
u
t
[
3
]
=
{
1
,
2
,
3
,
5
,
7
,
1
1
,
1
3
,
1
7
,
1
9
,
2
3
,
2
9
,
3
1
,
3
7
,
4
1
,
4
3
,
4
7
,
5
3
,
5
9
,
6
1
,
6
7
,
7
1
,
7
3
,
7
9
,
8
3
,
8
9
,
9
7
}
The numbers that don't occur are the primes.
Here's the 10th prime:
I
n
[
4
]
:
=
P
r
i
m
e
[
1
0
]
O
u
t
[
4
]
=
2
9
A table of the first 50 primes:
I
n
[
5
]
:
=
T
a
b
l
e
[
P
r
i
m
e
[
n
]
,
{
n
,
5
0
}
]
O
u
t
[
5
]
=
{
2
,
3
,
5
,
7
,
1
1
,
1
3
,
1
7
,
1
9
,
2
3
,
2
9
,
3
1
,
3
7
,
4
1
,
4
3
,
4
7
,
5
3
,
5
9
,
6
1
,
6
7
,
7
1
,
7
3
,
7
9
,
8
3
,
8
9
,
9
7
,
1
0
1
,
1
0
3
,
1
0
7
,
1
0
9
,
1
1
3
,
1
2
7
,
1
3
1
,
1
3
7
,
1
3
9
,
1
4
9
,
1
5
1
,
1
5
7
,
1
6
3
,
1
6
7
,
1
7
3
,
1
7
9
,
1
8
1
,
1
9
1
,
1
9
3
,
1
9
7
,
1
9
9
,
2
1
1
,
2
2
3
,
2
2
7
,
2
2
9
}
The millionth prime:
I
n
[
6
]
:
=
P
r
i
m
e
[
1
0
0
0
0
0
0
]
O
u
t
[
6
]
=
1
5
4
8
5
8
6
3
The 10^10th prime:
I
n
[
7
]
:
=
P
r
i
m
e
[
1
0
^
1
0
]
O
u
t
[
7
]
=
2
5
2
0
9
7
8
0
0
6
2
3
Counting Primes
(
5
)
The number of primes less than 100:
I
n
[
1
]
:
=
L
e
n
g
t
h
[
C
o
m
p
l
e
m
e
n
t
[
R
a
n
g
e
[
1
0
0
]
,
U
n
i
o
n
[
F
l
a
t
t
e
n
[
T
a
b
l
e
[
a
*
b
,
{
a
,
2
,
5
0
}
,
{
b
,
2
,
5
0
}
]
]
]
]
]
O
u
t
[
1
]
=
2
6
P
r
i
m
e
P
i
computes this (though doesn't treat 1 as a prime):
I
n
[
2
]
:
=
P
r
i
m
e
P
i
[
1
0
0
]
O
u
t
[
2
]
=
2
5
Because 1 isn't a prime,
P
r
i
m
e
P
i
[
2
]
is 1:
I
n
[
3
]
:
=
P
r
i
m
e
P
i
[
2
]
O
u
t
[
3
]
=
1
Plot the number of primes less than a given number:
I
n
[
4
]
:
=
L
i
s
t
P
l
o
t
[
T
a
b
l
e
[
P
r
i
m
e
[
n
]
,
{
n
,
5
0
}
]
]
O
u
t
[
4
]
=
A larger version:
I
n
[
5
]
:
=
L
i
s
t
P
l
o
t
[
T
a
b
l
e
[
P
r
i
m
e
[
n
]
,
{
n
,
1
0
0
0
}
]
]
O
u
t
[
5
]
=
See Also
MersennePrime
Related Symbols
Prime
PrimePi
PrimeQ
Publisher Information
Contributed by:
Wolfram Staff