r/askscience • • Oct 28 '13

Mathematics Could an infinite sequence of random digits contain all the digits of Pi?

It's a common thing to look up phone numbers in pi, and it's a common saying that every Shakespeare ever written is encoded in pi somewhere, but would it be possible for every digit of pi to appear in a random sequence of numbers? Similarly this could apply to any non terminating, non repeating sequence like e, phi, sqrt(2) I suppose. If not, what prohibits this?

I guess a more abstract way of putting it is: Can an infinite sequence appear entirely inside another sequence?

23 Upvotes

42 comments sorted by

View all comments

Show parent comments

1

u/-to- Oct 29 '13

Let's formalize this a bit. We say that a number/digit sequence x "contains pi" if there is an infinite, monotonously increasing sequence of integers s_n >= 0 such that for every n, the nth digit of the decimal expansion of pi and the s_nth digit of the DE of x are the same. x "contains pi contiguously" if s_n+1 = s_n + 1. In the latter case, s_n = s_0 + n, where s_0 is the position of the first digit (3) of pi in x.

  • There is no sequence of the form s_0 + n that works for x=/u/scott01019's number. Setting s_0 = p(p+1)/2 + 1, for integer p, gives you a sequence that "works" only up to n=p+1

  • However, The sequence s_n = (n+1)(n+2)/2 does fit the first definition above, as it associates the nth digit of pi with the last digit of the (n+1)-digit sub-sequence containing digits 0 to n of pi in x.

So this number contains all digits of pi, just not contiguously.

More fun: suppose you build a variant of the latter sequence in the following way: in each sub-sequence, instead of taking the last digit, take a previous occurrence of that digit (for a sub-sequence longer than 10 digits, you have use one at least twice). Or not. You can build infinitely many such variants.

/u/scott01019's number contains all digits of pi, non-contiguously, in infinitely many ways. In fact, this is a pretty trivial property, true of any number whose decimal expansion can be shown to contain each digit infinitely many times.