This marks one of the earliest recorded instances of grad student abuse.

Medium (~10 number such that 1remainder after division by N.  You wouldn’t want to use it to check all the numbers up to, say, 450787.

Eratosthenes, in a completely unrelated project, accurately calculated the circumference of the Earth around 2200 years ago using nothing more than the Sun, a little trigonometry, and some dude willing to walk the ~900km between Alexandria and Syene.

The “Fibonacci sequence” is defined as a sequence of numbers such that you have the recursion: , and the restrictions: and .

Explicitly, the Fibonacci sequence is: 1, 1, 2, 3, 5, 8, 13, 21, …

Every composite number has at least one factor less than or equal to its square root, so if the largest number on your map is N, then you only need to check up to √N.

After that, all of the remaining blanks are primes.

It’s , where the “≈” is close enough that you can round to the nearest integer.

Astute readers will notice that is the golden ratio, and may wonder if this is a coincidence. Everything after this is a detailed, math-heavy explanation of where this formula comes from.

That is, the recursion says that every term is the sum of the previous two.

Tags: , ,