# Arithmetic Puzzle

Standard

Following is a very common arithmetic puzzle that you may have encountered as a child:

Express any whole number $n$ using the number 2 precisely four times and using only well-known mathematical symbols.

This puzzle has been discussed on pp. 172 of Graham Farmelo’s “The Strangest Man“, and how Paul Dirac solved it by using his knowledge of “well-known mathematical symbols”:

$\displaystyle{n = -\log_{2}\left(\log_{2}\left(2^{2^{-n}}\right)\right) = -\log_{2}\left(\log_{2}\left(\underbrace{\sqrt{\sqrt{\ldots\sqrt{2}}}}_\text{n times}\right)\right)}$

This is an example of thinking out of the box, enabling you to write any number using only three/four 2s. Though, using a transcendental function to solve an elementary problem may appear like an overkill.  But, building upon such ideas we can try to tackle the general problem, like the “four fours puzzle“.

This post on Puzzling.SE describes usage of following formula consisting of  trigonometric operation $\cos(\arctan(x)) = \frac{1}{\sqrt{1+x^2}}$ and $\tan(\arcsin(x))=\frac{x}{\sqrt{1-x^2}}$ to obtain the square root of any rational number from 0:

$\displaystyle{\tan\left(\arcsin\left(\cos\left(\arctan\left(\cos\left(\arctan\left(\sqrt{n}\right)\right)\right)\right)\right)\right)=\sqrt{n+1}}$.

Using this we can write $n$ using two 2s:

$\displaystyle{n = (\underbrace{\tan\arcsin\cos\arctan\cos\arctan}_{n-4\text{ times}}\,2)^2}$

or even with only one 2:

$\displaystyle{n = \underbrace{\tan\arcsin\cos\arctan\cos\arctan}_{n^2-4\text{ times}}\,2}$