# How Many Zeros in a Row are Possible in Pi?

**URL:** <https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562>\
**Category:** Factual Questions\
**Tags:** science-math\
**Created:** [September 21, 2024, 5:12pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562 "2024-09-21T17:12:42Z")\
**Posts on this page:** 20\
**Page:** 10

<div class="post-metadata">

**Author:** ![Measure\_for\_Measure](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/measure_for_measure/32/557_2.png) [@Measure\_for\_Measure](https://boards.straightdope.com/u/Measure_for_Measure)\
**Post date:** [September 30, 2024, 10:24pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/181 "2024-09-30T22:24:53Z")

</div>

Obligatory article on Niko Tosa, the man who beat roulette.

> **[Roulette mastermind claims he can beat the wheel through sheer focus](https://www.dailymail.co.uk/news/article-12021281/Roulette-mastermind-claims-beat-wheel-sheer-focus-practice.html)**
>
> Nearly two decades ago, roulette mastermind Niko Tosa and two of his partners were arrested after raking in$1.62 million at the upscale Ritz Club casino in London over several nights.

The insight is that you don’t need to know where the ball will land. You just need have a clear idea where the ball absolutely will _not_ land, then quickly spread your bets over the remainder. It turns out that modest imperfections can affect the wheel’s drop zone. Following a 2005 UK government report, casinos became much more careful about how roulette wheels were constructed and monitored for probability shifting wear and tear. Bloomberg has a more detailed but unfortunately paywalled article.

---

<div class="post-metadata">

**Author:** ![Pleonast](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pleonast/32/1183_2.png) [@Pleonast](https://boards.straightdope.com/u/Pleonast)\
**Post date:** [September 30, 2024, 11:23pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/182 "2024-09-30T23:23:03Z")

</div>

> [@Dr.Strangelove](#):
>
> There’s no such thing as a device or even mathematical concept that is immune to failure or error.

Are a finitist? Most mathematicians don’t worry that constructing the set of all whole numbers will fail at some unknown finite number.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 30, 2024, 11:29pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/183 "2024-09-30T23:29:11Z")

</div>

> [@Dr\_Paprika](#):
>
> We need more maids with mops.

If seven maids with seven mops  
Swept it for half a year,  
Do you suppose,’ the Walrus said,  
That they could get it clear?’  
‘I doubt it,’ said the Carpenter,  
And shed a bitter tear.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [September 30, 2024, 11:33pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/184 "2024-09-30T23:33:33Z")

</div>

No, I mean that even mathematical proofs are prone to human error. The probability of there being serious errors in our understanding of math is very small… but 1/1040 is just unimaginably tiny. If every human on the planet made a decision every second for their entire lives, if there was a single error in there it would only get you to 1/1020.

It does help a little that hopefully Earth’s mathematicians aren’t all making the _same_ errors, so if a sufficient number of mathematicians look at something and don’t find a problem, then our confidence goes up exponentially (and thus the chance of error might indeed be less than 1/1040). But that’s not going to be true for some of the most advanced proofs, where only a handful of people might have any understanding of it. I think that Wiles’ proof of Fermat’s Last Theorem has much more than a 1/1040 probability of being flawed, for instance.

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [September 30, 2024, 11:41pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/185 "2024-09-30T23:41:26Z")

</div>

Is being a “finitist” a real thing? How does that work?

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [September 30, 2024, 11:49pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/186 "2024-09-30T23:49:01Z")

</div>

If you’re a finitist, you say that infinity doesn’t exist but leave out the threshold.

If you’re an ultrafinitist, then you deny the existence of any number larger than you can count to.

---

<div class="post-metadata">

**Author:** ![Pleonast](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pleonast/32/1183_2.png) [@Pleonast](https://boards.straightdope.com/u/Pleonast)\
**Post date:** [October 1, 2024, 12:02am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/187 "2024-10-01T00:02:04Z")

</div>

With an appropriate definition of what it means for a number to “exist”.

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [October 1, 2024, 12:06am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/188 "2024-10-01T00:06:46Z")

</div>

> [@Dr.Strangelove](#):
>
> But 1040 is roughly _123_ spins of a wheel.

Is this a typo? I’m lost otherwise.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [October 1, 2024, 12:11am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/189 "2024-10-01T00:11:43Z")

</div>

> [@Exapno\_Mapcase](#):
>
> Is this a typo? I’m lost otherwise.

I was a little sloppy in how I expressed it, but the numbers 10^40 and (38/18)^123 are roughly equal. The odds of rolling a 10-sided die 40 times and getting 1 each time are about equal to getting red on a roulette wheel 123 times in a row.

---

<div class="post-metadata">

**Author:** ![wolfpup](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/wolfpup/32/10618_2.png) [@wolfpup](https://boards.straightdope.com/u/wolfpup)\
**Post date:** [October 1, 2024, 12:22am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/190 "2024-10-01T00:22:03Z")

</div>

All I’m saying is that extremely unlikely events can and do happen, though 1040 is indeed hyperbole. For example, the odds of winning the jackpot in one of our local lotteries is approximately 1 in 14 million. With the number of tickets being sold it’s not surprising that someone wins the jackpot at least half the time, if not more. But the thing is that, despite the fact that the jackpot odds are so ridiculously remote that buying tickets is for all practical purposes precisely equivalent to throwing money away, a number of people have won such lotteries **twice** (not sure about this specific one). If my calculations are correct, the probability of winning a lottery with those odds twice is around 1 in 196,000,000,000,000, yet it has happened and no one has uncovered anything being “rigged”.

---

<div class="post-metadata">

**Author:** ![Topologist](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/topologist/32/3208_2.png) [@Topologist](https://boards.straightdope.com/u/Topologist)\
**Post date:** [October 1, 2024, 12:26am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/191 "2024-10-01T00:26:36Z")

</div>

> [@Dr.Strangelove](#):
>
> But that’s not going to be true for some of the most advanced proofs, where only a handful of people might have any understanding of it.

A bit off topic but: Perhaps the most famous (within areas of math adjacent to mine) recent example was a proof published by the Fields Medal winner [Vladimir Voevodsky](https://en.wikipedia.org/wiki/Vladimir_Voevodsky) and Michael Kapronov in 1989. A counterexample was found by another mathematician in 1998, but it took until 2013 for Voevodsky to convince himself the original proof was wrong. The fact that a mistake like this could go undetected and unconfirmed so long (along with other mistakes he discovered in another paper of his) disturbed him so much that he spent the rest of his life developing homotopy type theory, a foundation for math that lends itself to computer theorem proving/verification software. He tells the story himself in a lecture whose slide deck [is available online](https://www.math.ias.edu/~vladimir/Site3/Univalent_Foundations_files/2014_IAS.pdf).

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [October 1, 2024, 12:48am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/192 "2024-10-01T00:48:16Z")

</div>

> [@Topologist](#):
>
> He tells the story himself in a lecture whose slide deck [is available online](https://www.math.ias.edu/~vladimir/Site3/Univalent_Foundations_files/2014_IAS.pdf).

Very interesting; thanks. I do think that proof assistants will help greatly. I almost used the 4-color theorem as my example, but it’s been checked by theorem-proving software so I decided on a different famous example.

I’ve been hearing good things about the Lean prover, but don’t know anything about its underpinnings.

Software can certainly contain bugs, but I don’t expect these bugs to manifest in subtle proof errors. Lean at least has a library of proofs you can use to prove further things, but at any point you can verify the library down to the fundamentals. So there’s no notion of things being on a rickety tower of other proofs that you can’t _totally_ depend on.

---

<div class="post-metadata">

**Author:** ![Topologist](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/topologist/32/3208_2.png) [@Topologist](https://boards.straightdope.com/u/Topologist)\
**Post date:** [October 1, 2024, 1:54am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/193 "2024-10-01T01:54:25Z")

</div>

> [@Dr.Strangelove](#):
>
> I’ve been hearing good things about the Lean prover, but don’t know anything about its underpinnings.

My last entry in this hijack: I haven’t used proof assistants myself, but it looks like Lean is one of those using dependent type theory, not homotopy type theory (HoTT), as its underpinnings. There’s a rundown of various proof assistants at the [nLab](https://ncatlab.org/nlab/show/proof+assistant). [Another page](https://ncatlab.org/nlab/show/proof+assistant) shows libraries of results built using HoTT specifically.

---

<div class="post-metadata">

**Author:** ![Dr\_Paprika](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr_paprika/32/3042_2.png) [@Dr\_Paprika](https://boards.straightdope.com/u/Dr_Paprika)\
**Post date:** [October 1, 2024, 1:56am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/194 "2024-10-01T01:56:48Z")

</div>

> [@Lumpy](#):
>
> If something has a probability of 1/ **n** , then the chance of it happening in **n** trials is 1/_ **e** _, or about 36%. So you’re never completely guaranteed to find a given string in a random real number’s expansion (until you do), although the odds get pretty favorable after a while.

I’m a bit tired at the moment, so I could certainly be mistaken. But if something has an independent probability of 1/n, repeated over n events, the probablility of it happening at least once is 1-[[(n-1)/n]^n], that is one minus the probability of it not happening even once in n tries. This would seem to converge to (1-1/e), about 64%, with a 1/e chance of not happening at all in the first n tries.

---

<div class="post-metadata">

**Author:** ![Exapno\_Mapcase](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/exapno_mapcase/32/1051_2.png) [@Exapno\_Mapcase](https://boards.straightdope.com/u/Exapno_Mapcase)\
**Post date:** [October 1, 2024, 3:06am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/195 "2024-10-01T03:06:03Z")

</div>

Thanks for the explanation.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [October 1, 2024, 3:14am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/196 "2024-10-01T03:14:43Z")

</div>

Sure thing. And if you want a simple mental approximation, a single 10x multiple is worth approximately 3 2x multiples. Alternately, one decimal digit is worth three binary digits, etc. So 10^40 =~ 2^120.

It’s actually closer to 3.3, but that’s only 10% error, which you can ignore for this sort of thing.

---

<div class="post-metadata">

**Author:** ![Dr\_Paprika](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr_paprika/32/3042_2.png) [@Dr\_Paprika](https://boards.straightdope.com/u/Dr_Paprika)\
**Post date:** [October 1, 2024, 4:11am UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/197 "2024-10-01T04:11:17Z")

</div>

Something with an independent probability of 1/n has about a 36% chance of not happening in n tries and a 13% chance of not happening in 2n tries. The approximations get better as n gets bigger.

---

<div class="post-metadata">

**Author:** ![Measure\_for\_Measure](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/measure_for_measure/32/557_2.png) [@Measure\_for\_Measure](https://boards.straightdope.com/u/Measure_for_Measure)\
**Post date:** [October 2, 2024, 5:32pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/198 "2024-10-02T17:32:10Z")

</div>

> [@Chronos](#):
>
> With many programs, the amount of extra time needed by the program is less than the amount of time that would be expended by the programmer determining whether double precision was needed or not. If performance actually matters, then make sure you’re working efficiently (which could mean lower precision, or it could mean restructuring your loops, or it could mean using a different language, or…). If it doesn’t, then just call everything double precision and call it a day.

Another vote for double precision. Stata allows for single or double precision storage but does all of its calculations in double precision. So you get rounding error in the single precision variables and resulting display columns like this:

```auto
.01
.02
.03000001
.04
.05000001
```

Now you can get around that with proper coding, aka extra programming time. No thanks: I’ll store everything double to avoid the issue. Storage is cheap.

Admittedly[Stata President Emeritus and author William Gould seemed to like single precision storage as of 2012.](https://blog.stata.com/2012/04/02/the-penultimate-guide-to-precision/) But that advice was outdated even then I think, unless you are working with very large datasets. Sometimes you are!

But yes, single precision (known as float in Stata’s language) is fine for most calculations. William Gould:

> [@William Gould](#):
>
> 5.5 (False precision.) Double precision is 536,870,912 times more accurate than float precision. You may worry that float precision is inadequate to accurately record your data.
> 
> Little in this world is measured to a relative accuracy of ±2-24, the accuracy provided by float precision.
> 
> Ms. Smith, it is reported, made $112,293 this year. Do you believe that is recorded to an accuracy of ±2-24\*112,293, or approximately ±0.7 cents?
> 
> David was born on 21jan1952, so on 27mar2012 he was 21,981 days old, or 60.18 years old. Recorded in float precision, the precision is ±60.18\*2-24, or roughly ±1.89 minutes.
> 
> Joe reported that he drives 12,234 miles per year. Do you believe that Joe’s report is accurate to ±12,234\*2-24, equivalent to ±3.85 feet?
> 
> A sample of 102,400 people reported that they drove, in total, 1,252,761,600 miles last year. Is that accurate to ±74.7 miles (float precision)? If it is, each of them is reporting with an accuracy of roughly ±3.85 feet.
> 
> The distance from the Earth to the moon is often reported as 384,401 kilometers. Recorded as a float, the precision is ±384,401\*2-24, or ±23 meters, or ±0.023 kilometers. Because the number was not reported as 384,401.000, one would assume float precision would be accurate to record that result. In fact, float precision is more than sufficiently accurate to record the distance because the distance from the Earth to the moon varies from 356,400 to 406,700 kilometers, some 50,300 kilometers. The distance would have been better reported as 384,401 ±25,150 kilometers. At best, the measurement 384,401 has relative accuracy of ±0.033 (it is accurate to roughly two digits).
> 
> Nonetheless, a few things have been measured with more than float accuracy, and they stand out as crowning accomplishments of mankind. Use double as required.

Using double all the time also removes worries about whether your variable might be used for an intermediate calculation:

> [@William Gould](#):
>
> Advice for programmers
> 
> 8.1 Stata does all calculations in double (and sometimes quad) precision.
> 
> Float precision may be adequate for recording most data, but float precision is inadequate for performing calculations. That is why Stata does all calculations in double precision. Float precision is also inadequate for storing the results of intermediate calculations.
> 
> There is only one situation in which you need to exercise caution—if you create variables in the data containing intermediate results. Be sure to create all such variables as doubles.
> 
> 8.2 The same quad-precision routines StataCorp uses are available to you in Mata; see the manual entries [M-5] mean, [M-5] sum, [M-5] runningsum, and [M-5] quadcross. Use them as you judge necessary.

Personally I use storage types as a way to indicate what kind of variable I’m using - is it a dummy or categorical variable, an integer, or a real number (byte, long, and double in Stata’s language)? For me it’s a label for the programmer more than a way of saving storage space.

(Stata has other storage types, but I don’t need to get into them here.)

---

<div class="post-metadata">

**Author:** ![74westy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/74westy/32/3950_2.png) [@74westy](https://boards.straightdope.com/u/74westy)\
**Post date:** [October 2, 2024, 7:07pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/199 "2024-10-02T19:07:20Z")

</div>

In the late '80s, at my first IT job, my boss presented me with an old school (max 2 letter variable names) basic program and told me to find out why it didn’t give the same results when we ran it on a new 286 pc clone as it gave in the old Zenix TSR-80 II or whatever it was.

The program was written by a nerdy old land surveyor to perform least squares adjustments of survey data. That means it reads a set of survey measurements (measured angles and distances between points.) The measurements are redundant (there are measurements that could in principle be derived from other measurements) and the measurements had some error (duh! They’re measurements). The programs took the measurements a provided a least squares solution that finds a consistent set of measurements that minimizes the amount that measurements have to be changed to make the set consistent. It also calculates coordinates for all points and gives statistical error bars on the location of each point.

Pretty math heavy.

I couldn’t specify the precision of variables in old school basic so I wrapped every calculation in a function that rounded the result to a specified number of decimal places before assigning the result to a variable.

The closer the the number of digits were to 8 (approx. single precision) the closer the end result came to what the old computer said. Showed my boss why the numbers were different and why the new ones were better.

> [@William Gould quoted by Measure\_for\_Measure](#):
>
> There is only one situation in which you need to exercise caution—if you create variables in the data containing intermediate results. Be sure to create all such variables as doubles.

In any math heavy software, there are intermediate results stored in variables. Many calculations are iterative.

LTDR: Might have been different in the '80s but in the '20s declare all floating point variables as double unless you know why you’re doing otherwise.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [October 2, 2024, 7:18pm UTC](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562/200 "2024-10-02T19:18:46Z")

</div>

> [@Measure\_for\_Measure](#):
>
> ```auto
> .05000001
> 
> ```
> 
> Now you can get around that with proper coding, aka extra programming time. No thanks: I’ll store everything double to avoid the issue

Storing as double doesn’t avoid this issue. It’s fundamental to floating point, and the fact that 1/5 in binary does not have an exact representation. If you just printed more digits you’d see the problem. Or, if you print fewer digits for single-precision it would avoid that as well.

In my industry, even single-precision is a luxury. Half-precision is commonplace. And even less–8 bit, 4 bit, sometimes just one bit (no longer floating point).

[Previous page](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562.md?page=9)

[Next page](https://boards.straightdope.com/t/how-many-zeros-in-a-row-are-possible-in-pi/1007562.md?page=11)
