# Prime Generation Algorithm in Python

Simon has written a code in Python that generates primes using the finite list from Euclid’s proof that there are infinitely many primes. “Starting with one prime (2) the code uses the finite list to generate a couple more numbers that aren’t in the list but are primes. It may not even get to all the primes in the long run!” There is only one problem with Simon’s algorithmâ€¦

Simon has written down Euclid’s proof in his own words first https://imgur.com/ML2tI6n
and then decided to program it in Python.

# Fundamental Theorem of Arithmetic

Simon working on his proof of the Fundamental Theorem of Arithmetic (he got stuck and then searched for existing proofs online).

# Looking for Primes

Simon programmed this grid of numbers and then used Paint to color the numbers in that are multiples of other numbers, an Eratosthenes way to look for prime numbers. When he compared his result to the prime number table that he found online it turned out to be a complete match!

Murderous Maths

# Magic Prime Number Pencils

No matter how much you sharpen either one of these pencils, it will keep having a prime number written on it. Simon adorned them with the largest truncatable prime and the largest right-truncatable prime.

# Trinity Hall Prime Number

Simon saw this pattern in a Numberphile video featuring Tadashi Tokieda and recreated it in Excel, adding colours. There are 30 columns and 45 rows of digits in this picture, which means it is made of 1350 digits – the year that Trinity Hall (in Cambridge) was founded. the bottom is all zeros, apart from a few glitches. The glitches were necessary because the whole thing (reading from right to left, top to bottom) is also one number and it is a prime number!

# Some more pictures of Simon’s everyday notes

Simon often drags his sketchbook to bed to “show me the beauty”, just before I would read a bedtime story to him and his sis. Last time he showed me a short proof of why there’re infinitely many primes. He assumed there were finitely many primes first… I think he learned that from James Grime:

Pi from Prime numbers:

Powers of 2:

# A Cool Number Guessing Trick! Or Brown’s Criterion in Processing

This is a fun number guessing trick, based on powers of 2 and the Fibonacci sequence, that even little kids can enjoy. You don’t have to know anything about the powers of 2 or Fibonacci to play this game, just basic addition up to 30. Yet, if you are more advanced, it is very interesting to see what lies underneath and even apply binary numbers to your guessing technique. Simon learned this trick from the Numberphile video on Brown’s Criterion.

Simon also made his own version of the game, based on prime numbers:

In this second part of the cool number guessing trick session, Simon shows his own version of the game, based on prime numbers. He discovered that it’s impossible to create this game for all numbers between 1 and 30 because some numbers (4 and 6) cannot be expressed as a sum of two different primes and was very upset about it. Yet he did manage to make the game and it works for all numbers except 4 and 6. To play the game, one player thinks of a number and the other player tries to guess it by asking whether the number is present on different sheets of paper. The answer is the sum of the numbers located in the top left corners of all the yes-sheets.

And please check out Part 3, where Simon actually programmed this game in Java (Processing):

Now it’s the computer guessing the number! The game is available on Simon’s GitHub to download at: https://github.com/simon-tiger/browns-criterion

Simon explained the rules in the GitHub README (because he “has a different writing style than Mom”, he said): https://github.com/simon-tiger/browns-criterion/blob/master/README.md