# The math behind a neat calculator trick

I received an interesting comment on yesterday’s blog post from Nemo. It was a cool calculator trick that I’d never seen before. Nemo wrote:

Reminds me of my favorite calculator trick.
Type in a bunch of 5’s: 555555, or whatever.
Press “1/x”.
Press “sin”.
Examine the mantissa of the result. Magic!

Well, if you give it a try you find out that

${\sin(1/555555)=0.000000031415958=3.1415958\times 10^{-8}}$,

and similarly

${\sin(1/5555555555)=3.141592653903954\times 10^{-12}}$.

Surely it can’t be a coincidence that the significant digits look so much like ${\pi}$. It isn’t.

So why does this work?

First, notice that ${\displaystyle \frac{1}{180}=0.005555\bar{5}}$. Thus, if ${n_{k}=555\cdots 5}$ (the ${k}$-digit integer of all 5’s), then ${\displaystyle \frac{1}{n_{k}}\approx 180\times 10^{-k-2}}$.

Also, you may remember that for ${x}$ close to zero, ${\sin(x)\approx x}$. Of course, this is only true if you are using radians. If you are using degrees, then for ${x}$ close to zero ${\displaystyle\sin x\approx \frac{\pi}{180}x}$.

Putting this all together we see that ${\displaystyle\sin(\frac{1}{n_{k}})=\sin(\frac{1}{555\cdots 5})\approx\frac{\pi}{180}(180\times 10^{-k-2})=\pi\times 10^{-k-2}}$.

Ta da!

1. Robert says:

Now take your result, multiply it time 1 x 10^(-k-2) so you get almost pi and subtract it from the real pi. The difference is close to pi (with the decimal point shifted).

1. Thanks, Robert! That’s amazing. Your comment inspired a follow-up post.

1. Usov says:

2. david says:

Nice. This was just small enough and interesting enough to fit into my working memory and give me a jolt of happy.

3. steve says:

Very nice trick, will be using that one myself =] and also nice explanation of why

4. est says:

Can we get e using similar trick?