ViewWiki

Lesson 2 of 4

Prime numbers.

About 25 minutes · 6 practice questions

What makes a number prime, how the sieve of Eratosthenes finds them all, why they thin out, and why primes are easy to multiply and hard to find again.

Step 1 of 6 · What a prime is

Step 1 of 6

What a prime is

A prime number is a whole number with exactly two divisors: 11⁠ and itself. 77⁠ is prime; 6=2×36 = 2 \times 3⁠ is not, and is called composite. Every composite number is a product of primes, in just one way: the primes are the building blocks of the numbers.

In the Scene the numbers from 11⁠ to 100100⁠ are laid out in a spiral on a tray of tiles. The primes are the raised gold tiles, the composites are low and dark, and 11⁠ is grey.

To the question

Step 2 of 6

The largest below a hundred

To check whether a number is prime, you need not try dividing it by every smaller number. It is enough to try the primes up to its square root: if n=a×bn = a \times b⁠, one of the factors is no bigger than n\sqrt{n}⁠.

To the question

Step 3 of 6

The sieve

Eratosthenes, in the third century BCE, found every prime up to a limit without testing any number on its own. The sieve of Eratosthenes circles 22⁠ and crosses out all its multiples, then circles the next number not crossed out, 33⁠, and crosses out its multiples, and so on. Every number left uncrossed is prime.

Count up to is now fixed at 400400⁠. Sieve the spiral will run the sieve: each prime crosses out its multiples in a colour of its own, from its square on, and the slate counts how many each one crossed out.

To the question

Step 4 of 6

Thinning out

The slate behind the tray counts the primes up to the limit. The further you count, the rarer they get, because a big number has more small primes that might divide it. And still they never run out: Euclid proved there are infinitely many primes.

To the question

Step 5 of 6

An eighth

At 10 00010\,000⁠ the tray is too large to show numbers, but the pattern stands out: the primes gather along diagonals. Nobody knows how to predict exactly where the next prime will appear.

To the question

Step 6 of 6

One easy direction

Multiplying two primes is easy, even when they are very long. Going the other way, finding the two primes from their product, is hard: no fast way is known to do it for numbers hundreds of digits long. An operation that is easy to do and hard to undo is the basis of cryptography, and the powers mod pp⁠ from the last Lesson are another such operation.

To the question

Still of the Prime numbers 3D scene
Interactive scene

Loading the interactive version…

Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.

To the experiment

Practice · Choose

Which of these numbers are prime? Choose all of them.

To the experiment

Practice · Calculate

Count up to is fixed at 100100⁠. What is the largest prime up to 100100⁠?

To the experiment

Practice · Predict, then look

Count up to is 400400⁠. The sieve of Eratosthenes circles a prime, crosses out its multiples, and moves on to the next prime. Through how many primes must it go before every tile left is prime? Choose, and then Sieve the spiral runs the sieve to the end.

To the experiment

Practice · Reach the target

Up to 100100⁠ there are 2525⁠ primes. Change Count up to until the slate shows 168168⁠ primes, then press Check.

To the experiment

Practice · Calculate

Count up to is fixed at 10 00010\,000⁠, and the slate shows how many primes there are up to there. What share of the numbers up to 10 00010\,000⁠ is prime? Answer in per cent.

To the experiment

Practice · Choose

Multiplying is easy: 89×97=863389 \times 97 = 8633⁠. Now the other way round: someone gives you only 86338633⁠. What is true of it?