Searching for the truth

Earlier today, I tweeted about my exciting new Pi search website, which lets you search for any string of digits within the infinite decimal expansion of π. If you haven’t seen it, go and check it out now.

I was inspired by seeing a lot of people getting excited about π for Pi Day, which took place a few weeks ago – all over the internet, memes like the ones above were breathlessly shared by excited universe-beauty-lovers and, hopefully, inspired some people to appreciate slightly better what it is about mathematics we mathematicians find so fascinating.

Unfortunately (and for those of you who’ve noticed the date, appropriately), the website I’ve built doesn’t actually do what it, and these lovely memes, claim to do. Yes, if you search for a string of digits it’ll return the position of that string within π, along with a chunk of digits either side:

The problem comes if you try to search for strings longer than about 4 digits. In that case, you’ll still get a result from the site, and it’ll tell you where to find it in the infinite decimal expansion of π:

But if you’ve taken the time to look up my JavaScript, which can be easily found in the source code (and anyone doing so should bear in mind that this is about the third thing I’ve ever written in JavaScript, and yes I know it’s terrible) you’ll notice that it’s doing something slightly different to what I’m claiming.

What Have You Done, Steckles

The code reads in the file pi_const.js, which contains the variable pi, which contains the digits of π. Impressively, my data storage optimisation is so efficient that this file, which contains all of the digits of an infinite non-repeating decimal (and based on the memes above, a good deal more besides) only takes up about 100KB of space. Suspicious!

Further digging might reveal that this file only actually contains about the first 100,000 digits of π, and if the number you’re searching for is found there, it’ll return the correct position and chunks of π from either side.

If your number isn’t found within that range, I’ve made use of a seeded random number generator – one which takes in an input and returns a randomly generated number, but in such a way that the same input will always give the same random number. (Earlier iterations of the site would find the long string of digits at different positions in π each time you refreshed the page, which I thought would be less convincing).

So unfortunately, if the position my site finds your number at in the digits of π is more than about 100,000, the chances are you’re being fed a line – the position, and the digits either side, are randomly generated and not actually anything to do with the digits of π. But you couldn’t tell, could you?!

Fool me π times, shame on… Euler?

In the classic April Fools’ tradition, the beauty of this trick is that on the face of it, you’d have no reason to suspect this isn’t just a genuine π search website. If you’ve recently shared a meme like the one above, you might even be pleased that someone’s bothered to implement something to let you find out exactly where the complete works of Shakespeare can be found in the circle constant.

The main reason someone might have to be suspicious of a website like this is that for several reasons, what I’m doing here isn’t possible.

• Reason #1: This is literally, as I said, like the third JavaScript programme I’ve ever written, so the chances of me being able to pull something like an infinite π searcher off, without a large dev team or loads of time, are slim at best. It’s also SUSPICIOUSLY quick to return a result.
• Reason #2: We don’t actually know enough digits of π. The longer the string you’re searching for, the less likely it’ll appear within a given chunk of π. From some brief investigations, the 100,000 digits I’ve given it do contain all 4-digit numbers (but ‘10000’ isn’t found in there!) and generally, if you’re looking for an n-digit string, you need an n-digit number of digits of π to be likely to find it. So, given that the current world record for computation of digits of π is about 62 trillion digits (a 14-digit number), searching for anything over 14 digits is likely to require me to literally bust the record for the number of digits that humanity as a species has ever calculated, which I again lack the computational resources to do.
• Reason #3, and the one which some people might have been getting annoyed by for a while now: the ‘fact’ so excitedly shared by the memes above isn’t actually known to be a fact. As nice as it would be, we haven’t actually proven mathematically that all possible strings of digits are present in the digits of π.

Disappointing as this sounds, the more you think about it, the less sense this assumption makes. Going from ‘pi is an infinite decimal which never repeats’ via a casual ‘means that’ to ‘it contains every possible finite string of digits’ is sloppy maths, easily disproven.

What if I were to take the digits of π and remove every occurrence of the number 7? I’d still have an infinite non-recurring decimal, but it wouldn’t contain every possible string of digits! The property we’re looking for here is something more subtle, which doesn’t necessarily fall out from just being an infinite non-repeating string of digits.

Normal service will be resumed

If a number has the property that each digit or string of digits of a given length occurs equally frequently in the digits, it’s called a normal number. Having this property then implies the property attributed to π above – that it contains every possible string of digits (but not necessarily the other way round). Being normal is a beautiful and clever property for a number to have, and it’s been proven that in the uncountably infinite space of real numbers, almost every number has this property.

Annoyingly though, we don’t actually know what any of them are. Actually, that’s not true – there’s Champernowne’s constant, which is tediously defined as:

$0.1234567891011121314151617181920\ldots$

That is, the number made up by writing out every whole number in order one after the other and sticking them together as an infinite decimal. It’s normal, but doesn’t have any use beyond being an example of a normal number.

To further complicate things, the property of being normal depends on which number base you write the number in – since it’s about the digits. If a number is normal in every base, it’s called absolutely normal. If you’re only bothered about one number base, you can find some examples of rational numbers that have an equal proportion of each digit (called simply normal), a nice but obvious example being:

$\frac{123456789}{9999999999} = 0.\overline{0123456789}$

But this won’t have all the other properties of a normal number, since the equal-proportions rule doesn’t extend to two-or-more digit strings.

There are some numbers that have been shown to be normal, but they are inconveniently not computable, which means we can define them and say what they mean or are the solution to, but not actually work out what the digits of them are.

This is a reference to the Riemann hypothesis – at time of writing, still unproven.

It’s also strongly conjectured that various other irrational numbers, like π, e and the square root of 2 are normal – but a proof hasn’t yet been produced. So while it’s a lovely and elegant thought, the memes above might as well be saying ‘All the Riemann zeroes are on the critical line – isn’t that nice?’

I hope that my daft π search page has at least provided you with a small amount of amusement – and maybe this result will be proved in the future, in which case you’re fine to go ahead and share the memes and bask in the glory of clever numbers. For now, we’ll just have to go back to crunching our π calculations and wondering if some day we’ll discover that there stop being any 4s at all beyond about a squillion digits. Who knows?

Tags: , , , , ,

• Katie Steckles

Publicly engaging mathematician, Manchester MathsJam organiser, hairdo.

2 Responses to “Searching for the truth”

1. Travis

Is it worth noting that there are as many (by cardinality) not normal numbers, as normal numbers?