Previous puzzle

Take this puzzle of mine that I created around a week ago:

Take these 3 functions: $f(x):=x+8,g(x):=x^2-3,h(x):=\sqrt x$

Starting from $x=0$,$$\color{black}{\text{How many times will you need to apply }f,g,\text{ and }h\text{ to get }78}?$$or is the puzzle simply impossible?

My attempt:

$$\begin{align}g(0)=-3\quad&(1\text{ function})\\g(g(0))=6\quad&(2\text{ functions})\\g(g(g(0)))=33\quad&(3\text{ functions})\\f(g(g(g(0))))=41\quad&(4\text{ functions})\\f(f(g(g(g(0)))))=49\quad&(5\text{ functions})\\h(f(f(g(g(g(0))))))=7\quad&(6\text{ functions})\\g(h(f(f(g(g(g(0)))))))=46\quad&(7\text{ functions})\\f(f(f(f(g(h(f(f(g(g(g(0)))))))))))=78\quad&(11\text{ functions})\end{align}\\\therefore11\text{ functions are needed to solve this puzzle}$$

However, my question is

Is this the most optimized solution there is, or can you find a more efficient solution?


The title hints at a way of finding the most efficient solution. (if I have hinted at it correctly)


1 Answer 1


It can be done in


$g(g(h(g(h(g(0)))))) \\ = g(g(h(g(h(-3))))) \\ = g(g(h(g(\sqrt 3 i)))) \\ = g(g(h(-6))) \\ = g(g(\sqrt 6 i)) = g(-9) = 78$

  • $\begingroup$ Oh my, good job! My most optimized solution was with 9 functions but I did not think of the complex realm! good job! $\endgroup$
    – CrSb0001
    Commented Nov 29, 2023 at 1:54
  • 1
    $\begingroup$ Actually, there is a 7 that doesn't use complex numbers: gfgghfg and another one that doesn't even use negatives: gfghhff $\endgroup$ Commented Nov 29, 2023 at 2:01
  • $\begingroup$ Notably, since every h is directly inside a g, the choice of which complex square root you use is irrelevant. $\endgroup$ Commented Dec 1, 2023 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.