Category: Number Theory Level: 101
cross out multiples of 2, 3, 5, 7 ⇒ 25 primes below 100
Circle the next number that is not crossed out, then cross out its multiples. Whatever survives is prime.
Write 1 to 100 in a grid. The number 1 is not prime, since a prime needs exactly two factors and 1 has only one.
1 is not prime
Two is prime. Every other even number is a multiple of 2, so cross out 4, 6, 8, and so on. Half the grid goes in one move.
new crossings: 4, 6, 8, … (49 in all)
Three is the next survivor, so it is prime. Start crossing at 9, since 6 is already gone. Many multiples of 3 were crossed by 2 already.
new crossings: 9, 15, 21, … (16 in all)
Start at 25. Smaller multiples of 5, like 10, 15, and 20, already fell to 2 or 3.
new crossings: 25, 35, 55, … (6 in all)
Start at 49. Only three new numbers fall: 49, 77, and 91. The sieve is running out of work.
new crossings: 49, 77, 91 (3 in all)
The next prime is 11, but 11² = 121 is past 100. Any composite number up to 100 has a factor of 10 or less, so it is already crossed out. Every survivor is prime.
25 primes from 2 to 97
cd svg-generator python3 -m svgmath render sieve-of-eratosthenes --out /tmp/sieve-of-eratosthenes
Source: svgmath/diagrams/factors.py