Good morning everyone!

I thought that there was no formula for prime numbers. There are things that look like they will generate prime numbers, but don’t – for example, let . At first glance this seems to work:

- , which is prime.
- , which is prime.
- , which is prime.

and this continues for a while… - , which is prime.

But then: - , which is not prime.

Bummer! This formula appears to be due to Leonard Euler, a Swiss mathematician who lived in the 1700s and is the namesake for one of our cats.

But it turns out the world of prime formulas is more complicated than I’d realized, and there are formulas that work! Sort of. The first is Wilson’s formula, named after John Wilson, a mathematician and judge who lived in England in the 1700s, although in doing a quick reference check I just saw that it was used 700 years earlier by **Abu Ali al-Hasan ibn al-Haytham**, who should really get his own Monday Morning Math. (Note made for the future.) This formula can be written several ways, but the way I first saw it – earlier this month, when Q came and wrote it on my white board and said this would make a great topic for Monday Morning Math (Thanks Q!) is this:

is prime if and only if

For example,

- When then and sure enough is a prime number.
- When , then and is also prime!
- But when then and is not prime.

This is a formula, but it’s perhaps more of a test for prime numbers than a formula for generating them. For that we’ll turn to Willans’ formula, found by C.P. Willans in 1964:

When this formula produces , which is the first prime. When it gives , which is the second prime. And so on – you get all the primes this way!!!! Pretty amazing. You can watch a youtube video all about it here:

Happy priming!

Sources: Wikipedia and Q