This page is not about code I want to share, but a file I want to share. It contains one billion digits of τ, "Tau", also known as 2π. The reason is that I wanted to find the digits of τ inside its own decimal expansion, and I needed at least a billion to search in. And I did, see at the end of the article. However the journey wasn't trivial because I didn't find any file online with a enough number of digits of τ, no matter how much I searched. So I had to compute them myself, and made this page to share the one billion digits of τ with you.
Files containing many digits of π are easy to find. In fact I quickly found one with one billion digits hosted at the MIT Student Information Processing Board website: https://stuff.mit.edu/afs/sipb/contrib/pi/. So I download it and multiply it by two, which just took about 3 seconds, even with the simplest algorithm. However, as the idea of sharing the file online for others to use started to form in my head, I realized I had a problem with the dataset - my 1,000,000,000-th digit of τ could be wrong, if the 1,000,000,001-th digit of π, which was not present in the file I downloaded, was a 5, 6, 7, 8 or 9 - these digit would produce a carry. Eventually I found http://www.subidiom.com/pi/pi.asp, where I did a search for the last 10 digits of π in my 1 billion digits record, 5275045519. I found it at the right position and the page also listed a few following digits, including my missing 1,000,001-th digit, which is a 6. With that I could correct my last digit in the file from an 8 to a 9 and upload the whole billion digits of τ here to save you all this trouble:
These are ascii files, compressed in ZIP. The digits of τ are pretty uniformly random since π's digits are (and multiplying by two produces all the digits with equal probability again). So one would expect the compressed file size to be (109log210)/8 bytes long, which is 396 MB. But instead it is 445MB. I suppose file compressors are designed to compress data with patterns and lots of redundancy, and not so much for raw information entropy and white noise.
Anyways, the whole point of having the digits of τ was to find τ in τ. And here it is, you should be able to find these substrings as well:
62831853 at position 61,970,564
628318530 at position 405,747,242
As expected, in order to find an arbitrary string of length n, say your phone number, one needs to look in the order of 10n digits inside of the string. A fun fact is that you can find 10 digits of π inside of τ at position 52,567,168, which is two orders of magnitude earlier than what's statistically expectated.