# Four π's to make any integer

This is like the "four four's" puzzle.

The challenge is to represent any integer using $$\pi$$,$$\pi$$,$$\pi$$,$$\pi$$ (uses $$\pi$$ exactly $$4$$ times).

You can use common functions on a calculator:

• Normal arithmetic operations $$+ - * /$$
• Square root $$\surd$$
• Exponential $$(X^Y)$$
• Negative() or minus sign $$-$$
• Factorial
• $$\log_{10}$$ or $$\ln$$

• Trigonometric functions $$\sin, \cos, \tan$$

• Parentheses $$()$$

You cannot use

• Floor() or ceiling () functions
• More than four $$\pi$$

This is similar to $$\pi$$ Day puzzle one to twenty, but you are allowed to use logarithms and factorials.

I have written method in the answer section. Is there any more efficient or clever method? Is there a formula using 3 $$\pi$$'s?

Clarification: I'm looking for creative answers outside of the rules specified above too.

Disclosure: I run the YouTube channel MindYourDecisions and am working on a video. I will credit solutions and link to this thread.

• If log is allowed, what about exp? Do you permit factorial with fractional arguments? (I'm not asking because I have any particular reason to think they will help, though the fact that factorials of half-integers have pi in them is suggestive.) Feb 24, 2020 at 9:48
• I'm interested in any clever method, even outside of the rules above! I was hoping there might be something with the gamma function, inverse trig functions, or even something clever like converting from radians to degrees. The main thing is the expression can be input into a mobile phone calculator--so I wanted to disallow the floor or ceiling functions. Feb 25, 2020 at 0:06

If arc-functions (inverse trigonometrics) are allowed:

Like in this answer, we can manage to do this using only 1 $$\pi$$, using the formula $$N=\tan\underbrace{\arcsin\cos\arctan\cos}_{N^2\text{ times}}\,\sin\pi$$ (copied from that answer; we only substituted $$0$$ with $$\sin \pi$$ (we might use $$\tan \pi$$ or so)).

• Wow this is incredible! This topic this deserves its own video and I'm delighted the topic is based on an old USAMO problem. Feb 25, 2020 at 23:39

The case of $$0$$ is trivial, for example:

0 = $$\pi + \pi - \pi - \pi$$

For a positive integer $$n$$, we can write:

$$n = -\ln\left(\frac{\ln {\sqrt{\cdots{\sqrt{\pi}}}}}{\ln \pi}\right)\frac{1}{{\ln(-\cos(\pi) - \cos(\pi))}}$$

Note:

For the repeated square roots, there are a total of $$n$$ square roots.

And in case I made any typos, you can check the formula for $$n = 5$$ written on WolframAlpha.

For a negative integer $$n$$, we modify the formula by omitting the minus sign at the beginning.

$$n = \ln\left(\frac{\ln {\sqrt{\cdots{\sqrt{\pi}}}}}{\ln \pi}\right)\frac{1}{{\ln(-\cos(\pi) - \cos(\pi))}}$$

Further explanation: the formula is modified from Paul Dirac's version for $$2$$'s.

If $$\exp$$ is allowed, here's a solution using only two $$\pi$$s.

To represent any non-negative integer $$n$$, let $$w=\exp(-\cos(\pi))$$, $$u=\sqrt{...\sqrt{w}}$$ ($$n$$ layers of $$\sqrt{...}$$), $$s=\log(\sqrt{\exp(-\cos(\pi))})$$, $$n=\log(\log(u))/\log(s)$$. It's easy to see that $$w=e$$, $$u=e^{2^{-n}}$$, $$s=1/2$$. Negate this method for negative $$n$$.

Just for fun, if $$floor$$ and $$exp$$ are allowed, only one $$\pi$$ is enough.

We only need to represent any non-negative integer $$n$$. First, we can get an integer $$n' \geq n$$, by $$\lfloor \pi \rfloor!!!...!$$. Then, we can try to get $$x-1$$ from $$x$$. We have $$\lfloor \log(\log(\sqrt{\exp(\exp(x))}))\rfloor=\lfloor x-\log(2) \rfloor=x-1$$.

I have to share this creative solution outside of the rules since I haven't seen this kind of formula written on any site.

Hannes W commented on my video with a method to make any number using just a single $$\pi$$ as follows:

$$-\log\sqrt{(-\cos \pi))\%\%\cdots\%}$$

Note:

There are a total of $$n$$ percentage symbols, and the logarithm is base $$10$$.

• However, you did not stated that the percentage symbol/function is allowed. Mar 15, 2020 at 8:18
• Fair point and my mistake! I changed the accepted answer back to yours since it is both within the rules and a great answer. In the video I did show a calculator with a percentage symbol and got crossed up that I didn't mention it here. Mar 15, 2020 at 17:26
• Thanks! To be honest, my answer is also in the grey zone (arcus functions are not mentioned too). Mar 15, 2020 at 17:42
• Breaking rules/being creative is one of the reasons I submitted to Puzzling SE rather than Math SE (where I agree a precise statement is important). Mar 15, 2020 at 23:04

I also thought of Dirac's formula. Here's a formula for an arbitrary fraction:

$$\pm {m \over n} = \pm { \ln { \ln \sqrt { \sqrt { \cdots \sqrt {\pi}}} \over \ln \pi } \over \ln { \ln \sqrt { \sqrt { \cdots \sqrt {\pi}}} \over \ln \pi } }$$

where first thingy has m nested square roots the second thingy has n nested square roots.