This is a clever idea that seems obvious only after you have seen it. Are there other applications waiting to be thought up?

Jack Hodkinson is a math student at Cambridge and he decided to find a prime that when expressed in binary in a grid produced a picture that looked like Corpus Christi College. There is nothing special about the particular image chosen you could go in search of a prime that produced an image of a celebrity or your cat.

So how do you do it?

At first it seems impossible. There may well be provably infinite primes but finding one that looks like Corpus Christi seems to be an unlikely quest. However, this is overlooking some interesting ideas abouit how many primes there are in a given interval.

The procedure adopted was to first create an image of the building, then digitize it and display it as an array digits. Then take the digits and read them as single large number. In this case the result had 2688 digits - that's a big number. The final step is to generate some random deviations from the number and test these for primality. As long as the random changes are small, any prime that you find will look like the original image with some undetectable random changes.

To speed things up the random set was tested using the Miller-Rabin primality test, which allows you to conclude that a number is prime with a high degree of probability. Usually the Miller-Rabin test is good enough, after being applied a few times, to be as certain as makes no difference that a number is a prime, but in this case it seems we need the ultimate proof. To test absolutely that the eight candidates were prime or not, a fast factorization algorithm was used. All eight candidates had no factors and so they were all prime.

This means that rather than looking for a needle in a haystack there are eight primes that all look quite close to a picture of Corpus Christi. The oversupply problem was solved by selecting the best looking:

So what appeared to be difficult was in fact much easier than you would have guessed - unless of course you had already worked out that there are aproximately 1.6 x 10^{2683} primes with 2688 digits. Putting this another way, one in 6200 2688 digit numbers are primes and as we only need consider odd numbers that is more like one in 3100 candidate numbers is prime.

If you work with a large enough number of digits you are likely to find a prime that is fairly close to any reasonable bit pattern you pick. This means that you aren't restricted to the Corpus Christi prime. You could find the Homer Simpson prime or your selfie as a prime.

Is there any value in this?

Apart from fun probably not, but look out for the first web service that delivers you a picture prime of your choosing.

Firefox 58 has just been released to end users, but it has some interesting changes for programmers as well Mozilla really does seem to be bringing Firefox into the 21st century, leaving its legacy ar [ ... ]

PHP is one of the most widely used programming languages for web development and if you're a web developer you really can't avoid it. Here is a selection of helpul posts about the language and its fra [ ... ]