Finding Pi

As one does, I was generating random arithmetic expressions and scoring by minimum descriptive length and how many digits of π\pi it approximated. I don’t really like integer approximations of π\pi as a “shorthand”, as they often aren’t particularly short. I figured by exploring a larger space of expresssions I might find something useful. I mostly found noise like:

[ 21/32] best=6.05 digits  sqrt(exp(-8) - ((-13) + sqrt(2 ** (-11) - ((-13) + cos(-11) + sqrt(exp(-1) - ((-13) + sqrt(10)))))))
[ 23/32] best=7.71 digits  sqrt(10 - (3 - sqrt(sqrt(sqrt(3) ** (-15) - (sqrt(sqrt(11)) + (-13)))) + (-2)) - sin(-5))
[ 20/32] best=6.69 digits  sqrt(sqrt((-15) / 10 + log(9)) / exp(10) + (3 / ((-13) + (-10)) + 10))

But I did spot one gem:

3+sin(3)+sin(3+sin(3))3 + sin(3) + sin(3 + sin(3))

I could see this was most likely part of an infinite sum for π\pi, which I was glad to confirm! The summation can be expressed recursively as:

f 0 = 3
f n = f(n - 1) + sin(f(n - 1))

or iteratively as

x = x + sin(x)

Why does this compute π\pi?

sin(x):

So, the sum or fixed point of the function converges towards π\pi given a reasonable starting value, fairly rapidly: the number of accurate digits roughly triples each step.

step value digits
0 3.00000000000000000000 1
1 3.14112000805986735230 4
2 3.14159265357219563697 11

Is it useful?

Like most approximations of π\pi, not really. It converges quickly, but repeatedly computing sin (for which you need to know π\pi) is a worse problem than we started with.