# How many consecutive positive integers can you make using exactly four instances of the digit '4'?

Starting at 1 (which is 4 - $\sqrt4$ - 4/4), how many consecutive integers can you make using exactly four instances of the digit '4'?

Basic rules:

• Any operator symbol is "free".
• Any printed '4' counts toward your four '4's.
• Other digits are NOT allowed.
• Other characters like letters or miscellaneous punctuation are NOT allowed, unless you can provide some citation of an accepted mathematical definition.

Allowed operators (non-exhaustive):

• - Subtraction or Negation
• * Multiplication
• / Division
• $\sqrt4$ Square root (ignore the implicit '2' there)
• $\sqrt4$ Radical (in this case you've used two '4's)
• ^ Exponentiation
• ! Factorial
• ? Terminal function (4? = 4 + 3 + 2 + 1)
• 44 Concatenation (which in this case consumes two '4's)
• |4| Absolute value
• . Decimal point
• If you can find a way to use calc, trig, matrices, whatever, by all means please do
• Last time I tried this I allowed the ̇  operator e.g. 4/.4̇  is 36. – Neil Feb 26 '16 at 19:56
• @question_asker Yes, I typoed - it should say 4 * 4 / .4̇. – Neil Feb 26 '16 at 22:16
• If you allow any other symbol with an accepted mathematical definition, then doesn't that mean we have free and unlimited use of $-e^{i \pi}$, $\ln e$, $-\cos \pi$, and other such digitless ways of constructing 1? It seems like we don't even need the abstruse math of some of the answers below. – ruakh Feb 29 '16 at 4:53
• @ruakh I assume that we have access to any mathematical definition but not to any mathematical constant. So, no $\pi$, no $e$, no $i$. – MariusSiuram Feb 29 '16 at 8:41

All of them!

How?

For every positive integer $n$,$$\underbrace{\sec\arctan}_{n^2-1\text{ times}}\,\frac{44}{44}=n$$otherwise written as$$\sec\arctan(\sec\arctan(...\sec\arctan(\frac{44}{44})))$$so all positive integers can be made with four fours. (Idea from this answer.)

• There goes a whole category of puzzles :). +1 – Lawrence Feb 26 '16 at 4:34
• @Lawrence Only the ones that allow free trig functions! – f'' Feb 26 '16 at 4:42
• @question_asker That's shorthand for writing out $\sec\arctan$ that many times. For example, when $n=2$ the expression is $\sec\arctan\sec\arctan\sec\arctan\frac{44}{44}$. – f'' Feb 26 '16 at 13:27
• @StephanBijzitter - You never write 4^2-1. f"s answer only gives you the "pseudo-code" for how to write it. You would actually write sec arctan 15 times, followed by 44/44, i.e. sec arctan sec arctan sec arctan (...11 more times...) sec arctan 44/44 – Sphinxxx Feb 26 '16 at 15:28
• One day, @StephanBijzitter is going to come back and read what he's written here and make himself a massive facepalm. – pipe Feb 27 '16 at 2:30

## Prefix edit

Why not allow the double factorial? well, let's use it. For the record:

\begin{align} 0!! &= 1 \\ 5!! &= 3 \cdot 5 = 15 \\ 6!! &= 2 \cdot 4 \cdot 6 = 48 \\ \end{align}

Also the choose operator (also known as binomial coefficient).

# Modular approach

I had some fun doing it the long way, but then I decided to jump into a more modular / exploitable strategy. I will build it for a little bit, so bear with me for now :)

First, let's make the following list with one four:

\begin{align} 2 &= \sqrt 4 \\ 3 &= \left(\sqrt 4\right)? \\ 4 &= 4 \\ 6 &= \left(\sqrt 4\right)?! \\ 8 &= 4!! \\ 10 &= 4? \\ 21 &= \left(\sqrt 4\right)?!? \\ 24 &= 4! \\ 36 &= \left(4!!\right)? \\ 48 &= \left(\left(\sqrt 4\right)?!\right)!! = 6!!\\ 55 &= 4?? \end{align}

I can also consider $4 = \sqrt 4 + \sqrt 4$, so there is no need to consider the "extra fours".

From now on, I will use the fancy "one-four" substitution, and maybe some results will use less than four fours. But the translation from a compact equation to a "four-fours" equation is immediate.

Let's consider the following list of two-four numbers (I purposely omit the ones that can be obtained with a signel four):

\begin{align} 0 &= 4 - 4 \\ 1 &= \frac{4}{4} \\ 5 &= 2 + 3 \\ 7 &= 4 + 3 \\ 9 &= 3 + 6 \\ 11 &= 21 - 10 \\ 12 &= 10 + 2 \\ 13 &= 10 + 3 \\ 14 &= 10 + 4 \\ 15 &= 21 - 6 \\ 16 &= 4 \cdot 4 \\ 17 &= 21 - 4 \\ 18 &= 21 - 3 \\ 19 &= 21 - 2 \\ 20 &= 24 - 4 \\ 22 &= 24 - 2 \\ 23 &= 21 + 2 \\ 25 &= 21 + 4 \\ 26 &= 24 + 2 \\ 27 &= 24 + 3 \\ 28 &= 24 + 4 \end{align}

Up to this point we can get any integer below 28 with only two fours. My strategy will be obtaining numbers by combining the "high part" and "low part". So, given any two-four "high number" $n$ we can generate all integers between $n - 28$ and $n + 28$. And the resulting formula uses up to four fours.

We can trivially consider the following property:

$$\forall n < 55: \quad (n+1)? - n? < 56$$

So we can have a "dense-enough" set of high numbers by simply using the $?$ operator to the list of "two-four numbers". The maximum number at the moment is:

$$434 = 28? + 28 = (4! + 4)? + 4! + 4$$

To continue, we should pick integers with a maximum distance of 56 between them. The next integer should be at most 463, because $462 - 28 = 434$.

Next hand-picked "high numbers" (credit to @f'' for most of them!): \begin{align} 441 &= 21^2 \\ 465 &= (24 + 6)? \\ 504 &= 21*24 \\ 550 &= 55*10 \\ 600 &= 24?+24? \\ 630 &= \binom{36}{2} \\ 665 &= 6! - 55 \\ 720 &= 6! \\ 775 &= 6! + 55 \end{align}

My original post contained a exhaustive list up to 132 and some odd holes up to 148, holes that user @f fixed in the comments, so credit for him for that. But now that I present the alternative strategy, the original post seems overweighted and slow to load :(

• I haven't found any 2-four numbers between 600 and 665, but the gap (629 to 636) can be filled in other ways: $(\frac{10}{2})^4$ uses three fours to make 625, and the fourth one can add 4 (629), 6 (631), or 10 (635). Similarly, $21*3*10$ is three fours to make 630, and the fourth one can add 2 (632), 3 (633), 4 (634), or 6 (636). – f'' Feb 28 '16 at 17:01
• I'm not going to do this, because last time I tried it (about 40 years ago) I was still growing the list after three weeks. But I do remember making great use of the fact that dividing by the square root of point four recurring is equivalent to multiplying by 1.5. – Michael Kay Feb 28 '16 at 18:45

Well, for someone who's not a mathematics afficionado, the last bullet point (and its applications) seems like alien talk. So here's a list I've compiled which went until 40.

1 = 4-sqrt(4)-4/4
2 = 4-4+4-sqrt(4)
3 = (4+4+4)/4
4 = 4-sqrt(4)-sqrt(4)+4
5 = 4+sqrt(4)-4/4
6 = 4+sqrt(4)-4+4
7 = 4+sqrt(4)+4/4
8 = 4+4+4-4
9 = 4+4+4/4
10 = 4+4+4-sqrt(4)
11 = 4/.4+4/4
12 = 4+4+sqrt(4)+sqrt(4)
13 = 4?+4-4/4
14 = 4?+4+4-4
15 = 4?+4+4/4
16 = 4*4-4+4
17 = 4*4-4/4
18 = 4*4-4/sqrt(4)
19 = 4?+4?-4/4
20 = 4?+4?-4+4
21 = 4?+4?+4/4
22 = 4?+4?+4/sqrt(4)
23 = 4!-sqrt(4)+4/4
24 = 4*4+4+4
25 = 4!+sqrt(4)-4/4
26 = 4!+sqrt(4)-4+4
27 = 4!+sqrt(4)+4/4
28 = 4!+4-4+4
29 = 4!+4-4/4
30 = 4!+4+4/sqrt(4)
31 = 4??-4!+4-4
32 = 4!+4+sqrt(4)+sqrt(4)
33 = 4??-4!+4-sqrt(4)
34 = 4*4*sqrt(4)+sqrt(4)
35 = 4??-4!+sqrt(4)-sqrt(4)
36 = 4!+4+4+4
37 = 4??-4!+4+sqrt(4)
38 = 4!+4*4-sqrt(4)
39 = 4??-4?-4-sqrt(4)
40 = 4!+4*sqrt(sqrt(4^4))


I'm not taking away from the brilliance of the top voted answer, just thought someone would enjoy going about it in this way.

I'm not certain if 41 can (or cannot) be done excluding the functions that fall under the last bullet point. I will turn this into community wiki if people can contribute to extend this list.

Check out MariusSiuram's answer (and its edit history) for a longer answer and an approach to extend this list. I've decided to take an early retirement at 40. ;)

• I don't know what the ? operator is, but it seems that 4? is equal to 10. If this is true, then (4?) * 4 + 4/4 would make 41. – Svalorzen Feb 26 '16 at 14:29
• @Svalorzen if that is accepted, then (4?) * 4.4 - sqrt(4) would make 42. – Piotr Pytlik Feb 26 '16 at 14:40
• I compiled almost the same list without seeing your answer. I think that I forgot to refresh the page, silly me. Well, it was a nice ride :) – MariusSiuram Feb 26 '16 at 15:01

Solution for any odd number of fours different from one:

$$\underbrace{\sec\arctan}_{(n+4)^2-1\text{ times}}\,\frac{44 \cdots}{44 \cdots} - 4=n$$

This formula will make any positive integer $n$ from four fours:

$-\sqrt4\frac{\ln\left[\left(\ln\underbrace{\sqrt{\sqrt{\cdots\sqrt4}}}_{n}\right) / \ln4\right]}{\ln{4}}$.

If we allow the number $44$ to count as two fours, then we can also have:

$\underbrace{\sec\arctan\cdots\sec\arctan}_{n^2-1}\,\frac{44}{44}$.

• For $n=4$ your square root version is 4 for 4: 4 4s, 4 logs, 4 parentheses, 4 nested roots – humn Feb 26 '16 at 19:32
• The square-root version is from wikipedia (and also here). – Mr Pie Apr 15 '19 at 9:41

@f'' ‘s solution can be generalized for any positive even number of 4s.

But what about odd numbers of 4s?

One 4:

$$\begin{matrix} \underbrace{ \sec\arctan }_{ n^2-1 ~ \text{times} } \, \biggl( \cdots \root\of{\root\of{ \surd 4 }\,} \, \biggr) \end{matrix} = n$$

Three 4s to get 4 (or whatever number of nested √ s):

$${ \ln \ln 4 - \ln \ln \root\of{\root\of{\root\of{ \surd 4 }\,}\,} \over \ln \root\of 4 } = 4$$

• 4/(sqrt(4)sqrt(4)) - Three 4's to get 1, leaving you with an even number of fours left. Multiply the answer from f''. – Taemyr Feb 26 '16 at 9:07
• "Run-time error 14: out of string space" is not an answer. – user253751 Feb 26 '16 at 12:35
• Okay, deleted the nonsolution with infinitely many 4s. The point was that, even though infinitely many such solutions exist, no such answer can actually be written down. – humn Feb 26 '16 at 18:35

All of them. Using S(n) the successor function used in the Peano axioms to define all natural numbers. And is equivalent to S(n) = n+1

1 = 44/44
2 = S(44/44)
3 = S( S( 44/44 ) )

n+1 = S( n )

• I applaud your minimalism! – JamesFaix Mar 1 '16 at 12:42
• In C, 1 = (44/44), 2 = (44/44)++, 3 = ((44/44)++)++... – JamesFaix Mar 1 '16 at 12:46

Here is another way to get any number $$n$$ using four fours:

$$\Large\log_{\frac{\sqrt{4}}{4}}\bigg(\log_4\underbrace{\cdots\sqrt{\sqrt{\sqrt{ 4}}}}_{\text{n times}}\bigg)=n$$ Unfortunately, the nested radicals could be written as $$\sqrt[\large2^n]{4}$$ which uses a $$2$$, however that particular problem does not appear to be addressed in other like answers, so... ;)

• I think DIrac solved a problem like this with this method or something similar using logs – tom May 29 '19 at 21:48

All of them

Here is how:

Log sqrt(4)/4 [log4 sqrt4] = 1

The number of square roots dictates the result.

Log sqrt(4)/4 [log4 sqrtsqrt4] = 2

Etc

• I think DIrac solved a problem like this with this method or something similar using logs – tom May 29 '19 at 21:49