31

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):

  • + Addition
  • - Subtraction or Negation
  • * Multiplication
  • / Division
  • $\sqrt4$ Square root (ignore the implicit '2' there)
  • $\sqrt[4]4$ 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
bobble
  • 10,245
  • 4
  • 32
  • 80
JamesFaix
  • 429
  • 4
  • 7
  • Last time I tried this I allowed the ̇ operator e.g. 4/.4̇ is 36. – Neil Feb 26 '16 at 19:56
  • 1
    @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 04:53
  • 1
    @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 08:41
  • Can we use floor or ceil? – Number Basher May 30 '22 at 09:15

9 Answers9

78

Answer:

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.)

f''
  • 33,665
  • 4
  • 120
  • 165
  • 1
    Well played sir! – JamesFaix Feb 26 '16 at 03:37
  • 15
    There goes a whole category of puzzles :). +1 – Lawrence Feb 26 '16 at 04:34
  • 5
    @Lawrence Only the ones that allow free trig functions! – f'' Feb 26 '16 at 04:42
  • 1
    You could have left hand side squared and use $\frac{4}{\sqrt{4}}$ for that and $\frac{4}{4}$ for the 1. That way you'd only need $n$ repetitions. – Paul Evans Feb 26 '16 at 04:56
  • 2
    Not to nitpick, but doesn't the $n^2-1\ times$ include two non-allowed extra digits? – question_asker Feb 26 '16 at 13:03
  • 6
    @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
  • @question_asker No, you just repeat it that many times. If $n=2$, then the formula is sec arctan(sec arctan(sec arctan($\frac{44}{44}$))) – Trenin Feb 26 '16 at 13:27
  • @f'' aha, so you're saying you could express this without the $n^2-1$ at all? that answers my question perfectly, thank you! – question_asker Feb 26 '16 at 13:28
  • But if n = 4, does that not count as fifth instance of 4? The question states "using exactly four instances of 4", but if your input (which is used) is 4, that would make five fours. – Stephan Bijzitter Feb 26 '16 at 13:40
  • 1
    @StephanBijzitter (someone else correct me if I'm wrong here but) I think the 4 in that case would be the output. It's only "used" insofar as it tells you how many times to repeat the $sec\ arctan$ bit. – question_asker Feb 26 '16 at 14:12
  • 4
    @StephanBijzitter There wouldn't be a fifth 4 used. When n = 4, the expression has 15 occurrences of sec arctan: sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan sec arctan$\frac{44}{44}$ – Brian J Feb 26 '16 at 14:12
  • @question_asker Yes, exactly that – Brian J Feb 26 '16 at 14:14
  • Aye, I understand that, but let's write n^2-1 as 4^2-1 and we do have a fifth four. – Stephan Bijzitter Feb 26 '16 at 14:57
  • 5
    @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
  • Yeah okay, but you use 4 to write sec arctan 15 times. Guess it's a matter of semantics – Stephan Bijzitter Feb 26 '16 at 17:58
  • 4
    @Stephan: His answer is instructions for what to write down, not what you should actually write down. Sure, you use $n$ to figure out how many times you should write $\sec\arctan$, but that doesn't mean you ever write down $n$. – Deusovi Feb 26 '16 at 18:04
  • Broken MathJax in Brian J's comment is making the comments look funny, they overflow into the HNQ list... – vero Feb 27 '16 at 06:03
  • @pipe Maybe, maybe not) – Stephan Bijzitter Feb 27 '16 at 13:27
  • We are all facepalming for him already, no need for him to come back and do it at a later date. – ErikE Feb 27 '16 at 21:16
  • 1
    If we get to throw arbitrary mathematical functions in for free, we could just use $S$, the successor function. This puzzle is way too permissive. – user2357112 Feb 27 '16 at 23:14
  • The comments on this post are being discussed on MSE. – nhgrif Feb 28 '16 at 01:54
  • @nhgrif It's also on Puzzling Meta. – f'' Feb 28 '16 at 02:54
  • sec arctan 44/44 is not 1 no matter how you express it (at best it's 1.00025823112 if you secarctan (44) the divide by 44), therefore not an integer. Sec arctan-ing the second time you already getting something totally different. Or am I missing somthing ? – Overmind Apr 15 '19 at 07:58
  • @Overmind, for n=1, there will be no sec arctan (since 1^2-1=0). For n=2, there will be 3 sec arctan (2^2-1). And the result is 2. – justhalf Sep 02 '21 at 04:08
21

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 :(

MariusSiuram
  • 319
  • 1
  • 9
  • 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, $21310$ 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
20

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. ;)

CodeNewbie
  • 11,753
  • 2
  • 45
  • 87
  • 2
    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
  • 1
    @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
8

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$$

Svalorzen
  • 189
  • 1
8

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}$.

Esteemator
  • 181
  • 4
6

@f''&hairsp;‘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 √&hairsp;s):

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

humn
  • 21,899
  • 4
  • 60
  • 161
  • 3
    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 09:07
  • 4
    "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
6

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 )
Falco
  • 2,201
  • 12
  • 14
2

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... ;)

Mr Pie
  • 6,682
  • 1
  • 25
  • 88
  • I think DIrac solved a problem like this with this method or something similar using logs – tom May 29 '19 at 21:48
1

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

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