# Feynman's point in pi

• July 28th, 2014, 11:47 PM
anticorncob28
Feynman's point in pi
In the decimal expansion of pi, in the first 1000 digits there are six 9s in a row.
If you prefer tau over pi (like me), then the Feynman point is even better for tau. You get seven 9s instead of six. Can somebody tell me the probability of having six/seven of the same consecutive digits in 1000 digits? It'd be great if you can prove it using nothing more advanced than high school math. So far I've tried using induction-like but with no luck.
Say the probability of seven same digits in x digits is f(x). Trivially, f(0) = f(1) = f(2) = f(3) = f(4) = f(5) = f(6) = 0 and then f(7) = 1/10^6. Then I tried finding a recursive formula for f(n).
If I have n digits, the probability that the seven digits occur in the first n - 1 digits is f(n - 1). If it occurs at all but needs the last digit we have something of the form _ _ ... _abbbbbbb where a and b are distinct digits and we have n - 8 blanks before. But I can't figure out how many ways we can fill in the blanks. The last six digits cannot be all a's, otherwise we have seven of the same digit in a row that doesn't need the last digit.
• July 29th, 2014, 03:16 AM
MagiMaster
The probability of k 9's in a string of random digits can be worked out like this. First, let's answer the question, what is the probability that we will not see a string of k 9s after n digits knowing the last r digits are 9s. Let's call this p(k, n, r). More on r in a minute.

Look at the last k digits. There are k cases to consider depending on where the first non-9 is. Since we're only considering the cases without k consecutive 9s, there must be at least one. In each case, we no longer care about the digits after that and can recurse on the problem with a now shorter string knowing it ends in a few 9s.

For example, if we're calculating p(4, 10, 0) we have 4 cases (using 0 as a placeholder for any non-9 and x as a placeholder for any digit). The result will be the sum of each case since they are mutually exclusive.
...0xxx - which happens with a probability of (9/10) and we recurse on p(4, 6, 0)
...90xx - which happens with a probability of (1/10)*(9/10) and we recurse on p(4, 7, 1)
...990x - etc.
...9990

How does having 9s on the end change things? It's pretty straightforward. We simply discard any cases that'd conflict with that. We already counted the probability for those trailing 9s, so no need to count it again.

Recurse until you hit one something you can compute directly. (I came up with four separate base cases.) Then your final answer will be 1 minus the result, or 1 - p(6, 1000, 0) for your question.

Now, I wrote up a little Python program to compute this. Assuming I haven't messed up somewhere (not entirely unlikely), I get that the probability is about 0.9% or about 1 in 112.

Here's the program:
Code:

```import math memo = {} def p(k, n, r):     if (k,n,r) in memo:         return memo[(k,n,r)]     if r >= k:         return 0     if k == 1:         return math.pow(9/10, n)     if k > n:         return 1     if k == n:         return 1 - math.pow(1/10, n - r)     t = 0     for i in range(k-r):         t += math.pow(1/10, i) * (9/10) * p(k, n-k+i, i)     memo[(k,n,r)] = t     return t print(1 - p(6, 10000, 0))```
Edit: Oh. I should point out that I'm fairly certain there's easier ways to do this, but I'm not so certain there's a closed form for the answer. This is just what I came up with off the top of my head (more or less).
• July 30th, 2014, 02:39 AM
Daecon
Would the probability lessen in correlation to the base number system? What if we calculated pi in hexadecimal?
• July 30th, 2014, 11:17 AM
someguy1
Quote:

Would the probability lessen in correlation to the base number system? What if we calculated pi in hexadecimal?

The digits of pi are deterministic, not random. They're generated by a simple algorithm. The probabalistic discussion is about finding a sequence of 9s in 1000 *random* digits. The probability of finding a sequence of 6 9's in the first 1000 digits of pi is 1. It happens and there is no possible way for it not to happen. The same argument would apply in any base. Either the sequence is there or it's not, and it's very easy to determine which is the case. There's no probability theory involved. I think this is a point of confusion that's starting to slip into the conversation.
• July 30th, 2014, 11:58 AM
anticorncob28
I'd like to know what's the probability of finding six (for pi) or seven (for tau) consecutive digits that are all the same, whether it's 9s or not. I've figured out how to do it for just 9s.
• July 30th, 2014, 12:49 PM
someguy1
Quote:

I'd like to know what's the probability of finding six (for pi) or seven (for tau) consecutive digits that are all the same, whether it's 9s or not. I've figured out how to do it for just 9s.

As I'm trying (unsuccessfully) to explain, this has nothing to do with probability. You just crank out the first 1000 digits, and inspect them for the sequences you're interested in. The digits are deterministic. If you run this experiment a million times it will come out exactly the same every time.

It's like saying, if if put the number 5 into the function f(x) = x^2, what's the probability that the answer is 12? You can't say that "all answers are equally likely" just because you haven't actually calculated the result. The answer is deterministic. It's 25, with probability 1.

It makes sense to ask what is the probability of a given sequence appearing in 1000 random digits. But it does not make sense to ask what is the probability of a given sequence appearing in the first 1000 digits of, say, 2^2^10. You just calculate it out. The sequence is either there or not. There's no concept of probability because there's no random event.
• July 30th, 2014, 01:24 PM
MagiMaster
Quote:

I'd like to know what's the probability of finding six (for pi) or seven (for tau) consecutive digits that are all the same, whether it's 9s or not. I've figured out how to do it for just 9s.

My algorithm should be adaptable, although, yeah, it's not a trivial change. The answer should be around 10 times the single digit answer (which would be the probability of runs of only one digit occurring) but obviously that'd only be an approximation.

While pi isn't random, it might be normal. (That's not proven, but a lot of people suspect it's true.) In that case, a randomly selected range of the digits would be well approximated by a random digit string. (A fixed selection will obviously still give a fixed answer.)
• July 30th, 2014, 05:22 PM
anticorncob28
Quote:

As I'm trying (unsuccessfully) to explain, this has nothing to do with probability. You just crank out the first 1000 digits, and inspect them for the sequences you're interested in. The digits are deterministic. If you run this experiment a million times it will come out exactly the same every time.

It's like saying, if if put the number 5 into the function f(x) = x^2, what's the probability that the answer is 12? You can't say that "all answers are equally likely" just because you haven't actually calculated the result. The answer is deterministic. It's 25, with probability 1.

It makes sense to ask what is the probability of a given sequence appearing in 1000 random digits. But it does not make sense to ask what is the probability of a given sequence appearing in the first 1000 digits of, say, 2^2^10. You just calculate it out. The sequence is either there or not. There's no concept of probability because there's no random event.
I understand what you're saying, and I'm sure everybody here does. I simply don't care to word it differently because everybody here understands what I mean.
Quote:

Would the probability lessen in correlation to the base number system? What if we calculated pi in hexadecimal?
The probability of 999999 in a random sequence of 1000 ((9 + 1)^3) hexadecimal digits goes down because there are 16^6 permutations of six digits, as opposed to only 10^6 in decimal.
If you're searching for six digits in a row that are the same, from 000000 to FFFFFF, then it still goes down. It becomes more obvious when you're working with a much bigger base, say base 200. There are 200 possible digits, and the odds of finding six exactly the same in a row in 1000 digits is exceptionally tiny.
• July 30th, 2014, 06:00 PM
someguy1
Quote:

I understand what you're saying, and I'm sure everybody here does.

I know you know what I'm saying. I disagree that everyone who reads this thread understands the point. People all over the Internet are confused about the distinction between random as in "no way to predict it ahead of time," versus randomness as a statistical phenomenon. That's why people ask about the odds of various sequences occurring in pi. And like I say, I'm of the opinion that a lot of people are confused about this. Which is why I mentioned it.

I do apologize if people think I said something too obvious to bother saying. I just happen to disagree.