OU blog

Personal Blogs

Richard Walker

A Prime Surprise

Visible to anyone in the world

It's quite surprising - to me at any rate - that if we take any positive number whatsoever, there is always a prime number that starts with the digits of the number we picked. In fact there are an infinite number of such primes.

I wrote a Python program that lets us input a number and searches for the first prime beginning with the number we entered.

Say we take Einstein's birthdate, 14/03/1879. Write this as 14031879 (which is not itself prime, it's divisible by 3).

Entering this into the program yields 140318797, which as you see starts with the famous scientist's birthdate, and has no divisors other than itself and 1, so it's prime.

Here's another example, this time a random number (I suppose) - the National Lottery jackpot for 14/09/2024, which was 21 27 38 47 49 55. Running the program and entering 212738474955 we get 2127384749557.

By tweaking the program we can get a list of the first few primes that start with the lottery number.

2127384749557
21273847495583
21273847495591
212738474955233

Fascinating!

Permalink
Share post