# Pieces of Pi

**URL:** <https://boards.straightdope.com/t/pieces-of-pi/325960>\
**Category:** Factual Questions\
**Created:** [October 12, 2005, 8:59pm UTC](https://boards.straightdope.com/t/pieces-of-pi/325960 "2005-10-12T20:59:28Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [October 14, 2005, 4:47am UTC](https://boards.straightdope.com/t/pieces-of-pi/325960/21 "2005-10-14T04:47:35Z")

</div>

> [@bonzer](#):
>
> In his 1988 paper on calculating the first 29 million or so places (reprinted in the Borwein’s _Pi: A Source Book_), David Bailey gives a formula for the expected number _M_ of repeats of length _n_ in _d_ digits. This is _M = 10[sup]-n[/sup] d[sup]2[/sup]/2_. (Which should be easy enough to prove, though I haven’t bothered checking.) There’s also a simple formula for the associated variance: _V = 11 M/9_. Neither result is quite exact, but they are good approximations.
> 
> The longest repeated sequence Bailey found involved 15 digits, though he doesn’t say what this was or where it was found. That’s about what you’d have expected based on the formulae above.  
> Since then, the calculation of the expansion has been pushed out to [1.2 trillion digits](http://mathworld.wolfram.com/PiDigits.html). You’d expect to be finding something like a 24 digit repeat somewhere in that.

There are two 16-digit repeated sequences in the first 180 million digits:

2994 9096 2576 2240 (at positions 23,974,220 and 152,251,556)  
6346 5019 1472 1352 (at positions 132,314,276 and 179,728,264).

There’s one 15-digit repeat within the first 30 million (2768 5455 1127 715), which is probably the one Bailey found.

I wouldn’t want to look for a 24-digit repeat without a _lot_ more memory than I currently have.

---

<div class="post-metadata">

**Author:** ![bonzer](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@bonzer](https://boards.straightdope.com/u/bonzer)\
**Post date:** [October 14, 2005, 12:34pm UTC](https://boards.straightdope.com/t/pieces-of-pi/325960/22 "2005-10-14T12:34:31Z")

</div>

> [@Omphaloskeptic](#):
>
> There are two 16-digit repeated sequences in the first 180 million digits:

Which is nicely consistent with Bailey’s formulae: the expectation is that you should find 1.6 repeats that long in those many digits.

---

<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 14, 2005, 4:10pm UTC](https://boards.straightdope.com/t/pieces-of-pi/325960/23 "2005-10-14T16:10:02Z")

</div>

What an interesting problem! Using the 200 million digits from the University of Tokyo and a little program I wrote, I’ve found the minimum number _m_ of digits required for a repeat of length _n_. [ol]  
[li] ‘1’ in 4 digits [_] ‘26’ in 23 digits [_] ‘592’ in 64 digits [_] ‘0582’ in 136 digits [_] ‘60943’ in 556 digits [_] ‘949129’ in 1302 digits [_] ‘8530614’ in 4608 digits [_] ‘52637962’ in 15442 digits [_] ‘201890888’ in 33853 digits [_] ‘4392366484’ in 240489 digits [_] ‘89879780761’ in 694410 digits [/ol]That’s as far as I’ve got in about 20 hours of cpu-time. (Time to think of a faster algorithm. 😉 )[/li]  
The scaling is _m_ ~ 2 _n_[sup]3[/sup]. This is different than the one described by **bonzer** , presumably because I’m finding the minimum number of digits for a repeat to exist.

---

<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 14, 2005, 4:27pm UTC](https://boards.straightdope.com/t/pieces-of-pi/325960/24 "2005-10-14T16:27:36Z")

</div>

Oops, I meant the scaling is _m_ ~ 2 3[sup]_n_[/sup]. Very different!

[Previous page](https://boards.straightdope.com/t/pieces-of-pi/325960.md?page=1)
