The Corpus Christi Prime
Written by Mike James   
Saturday, 30 September 2017

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 102683 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. 

More Information

The Corpus Christi Prime

Related Articles

Prime Numbers And Primality Testing

48th Mersenne Prime Discovered

Reaching The Unreachable - Pi Squared And Catalan's Constant

A Quantum Computer Finds Factors

Solve The Riemann Hypothesis With A Quantum Computer


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



Android 15 Developer Preview Updated

Google has released Android 15 Developer Preview 2 with changes including better handling of automatic language switching and updates for OpenJDK 17.

Excel Spreadsheet - A Joke?

No this isn't an April Fool's although in places it seems like one. It's a true account of how Williams Racing has suffered through reliance on an overgrown and outdated Microsoft Excel spreadsheet, l [ ... ]

More News

raspberry pi books



or email your comment to:





Last Updated ( Sunday, 01 October 2017 )