
Pi, PINs and Permutations - squeakynick
http://www.datagenetics.com/blog/march32015/index.html
======
pierre
If you want to play more with it and try to found when all 7 digit combination
of pi repeat themself, I build a Pi as a service API for pi day. It can serve
the first 1 billions digit of pi over http.

[http://piaas.org/](http://piaas.org/)

------
goodmachine
I love Datagenetics posts. Related:

[https://github.com/philipl/pifs](https://github.com/philipl/pifs)

------
marchelzo
6716 confirmed most secure 4-digit PIN.

~~~
gren
aha! not anymore now that we know ;-D

------
Sukotto
Why is the first pin 1415 and not 3141?

[edit to add] and I don't mean that in a snarky way. Was just curious.

~~~
squeakynick
No reason really. I just arbitrarily started using the digits after the
decimal point (to avoid the confusion of what to do with the ".")

Other Pi sites seem to follow similar protocol. It will create an "off-by-one"
for most answers, but since the string that is the furthest away does not
start with a "3", other than the off-by-one, it will not change the results :)

------
DEinspanjer
Just a random question that popped into my head while reading (thank you for
the article!)... What would be the longest repetitions of digits within
various orders of magnitude of Pi?

In other words, the first 10 characters (again looking at only the fractional
portion:

1415926535

The longest repetition is a length of one and the digit is 1.

Playing with regexes, I found:

In 100 digits, you get a repetition of the digits 592

In 1000 digits, the first longest repetition is 23846

In 10000 digits, I found a six digit repetition, 120190 but at that point, the
quadradic nature of the regex made searching for 7 impossible so I would
probably write a program that used something like suffix trees to get further.

------
rnhmjoj
There is this service to search in the digits:
[http://www.angio.net/pi/piquery](http://www.angio.net/pi/piquery)

------
gren
Is there any statistical/probabilistic explanation of why the answer is almost
100'000 ?

~~~
contravariant
If you approximate the positions of the pin numbers as independent exponential
distributions with parameter λ = 1/10000\. Then the expected value of the
maximum is the sum of 10000/k for k = 1 to 10000 [1], which is approximately
1000*(log(1000)+γ) with γ = 0.57721... [2]. This gives the following values
for the expected number of digits needed to get all k-digit pin numbers:

k | n

\------------

4 | 97,875.6

5 | 1,209,014.1

6 | 14,392,726.2

7 | 166,953,113.2

8 | 1,899,789,640.9

Which agrees reasonably well with the actual values, at least those found so
far.

[1] [http://math.stackexchange.com/questions/80475/kth-order-
stat...](http://math.stackexchange.com/questions/80475/kth-order-statistics-
of-n-i-i-d-exponential-distribution-random-variables-wi) [2]
[https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_const...](https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant)

------
deepsun
There's no proof that pi contains every possible number combinations. It's a
common misconception that somewhere in pi you'll find everything.

------
stansmith
One of the other articles referenced, about De Bruijn sequences, is much more
interesting
[http://www.datagenetics.com/blog/october22013/index.html](http://www.datagenetics.com/blog/october22013/index.html)

~~~
dang
Sockpuppet accounts are not allowed on Hacker News and will get your site
banned if you keep it up.

