This is a follow-up to "A truly amazing way of making the number 2016":

For every positive integer $n$, find a mathematical expression that yields the value $n$ while obeying the following rules:

  • Each of the digits $1,2,3,4,5,6,7,8,9$ is used exactly once
  • Decimal points are allowed
  • You may use brackets "(" and ")" to structure your expression, and to make it well-defined
  • The only allowed mathematical operations are addition (+), subtraction (-), multiplication (*), division (/); the minus sign may also be used as the sign of a negative number.
  • The only allowed mathematical functions are square-roots and logarithms. Logarithms must be written in the form $\log[b](x)$ to denote the base-$b$ logarithm of number $x$

Note that in particular the following is not allowed:

  • Juxtaposition of digits (as juxtaposing 1 and 3 to get "31")
  • using the digit 0, or using non-decimal digits
  • other mathematical operations and functions (cube-roots, exponentiation, factorials, absolute values, trigonometric functions, etc)
  • integration, differentiation, limits, matrices, and determinants
  • rounding up, rounding down, rounding to the nearest integer
  • 1
    $\begingroup$ This problem works just as well when restricted to the natural logarithm and is cleaner IMHO because you won't need the big hint about the base. Log[x](y). Is eqivalamt to ln(y)/ln(x) $\endgroup$ Commented Apr 17, 2016 at 20:24

4 Answers 4


We can use:

$$\log[2]\left(\frac{1}{\log[3]\left(\underbrace{\sqrt{\sqrt{ \ldots \sqrt{5-\sqrt{4}}}}}_\text{square root repeated $n$ times}\right)}\right) + 6 - 7 - 8 + 9$$

This works because:

$a^{\overbrace{b \cdot b \ldots b}^\text{$n$ times}} = a^{b^n}$, and since $\sqrt{a} = a^{\frac12}$ we have that $\sqrt{\sqrt{ \ldots \sqrt{5 - \sqrt{4}}}} = 3^{\left(\frac12\right)^n} = 3^{\frac1{2^n}}$
Now, $\text{log}[a](a^c) = c$, so $\text{log}[3]\left(3^{\frac1{2^n}}\right) = \frac1{2^n}$
Finally, by the same token: \begin{equation}\text{log}[2]\left(\frac1{\frac1{2^n}}\right) = \text{log}[2]\left(2^n\right) = n\end{equation} The rest is simply adding the unneeded numbers in a zero sum.

If you want a version with the numbers in order for 1 to 9, we can do a small manipulation:

$$-1\cdot\log[2]\left(\log[3]\left(\underbrace{\sqrt{\sqrt{ \ldots \sqrt{-\sqrt{4}+5}}}}_\text{square root repeated $n$ times}\right)\right) + 6 - 7 - 8 + 9$$

  • $\begingroup$ you should use code or math formatting for the math, it's much easier to read $\endgroup$
    – cat
    Commented Mar 6, 2016 at 19:47
  • 3
    $\begingroup$ I hope i haven't changed the meaning of the answer while editing. $\endgroup$
    – manshu
    Commented Mar 6, 2016 at 19:59
  • $\begingroup$ @manshu that's great - thanks :) ) I tried and failed with matjax :( $\endgroup$
    – Paul Evans
    Commented Mar 6, 2016 at 20:05
  • 2
    $\begingroup$ Here is something to bookmark in your browser :) $\endgroup$
    – manshu
    Commented Mar 6, 2016 at 20:45
  • $\begingroup$ @Fimpellizieri Oh, really super edit! Just had to add $2$ blanks at the end of a couple lines. Thanks - like the overbrace! :) ) $\endgroup$
    – Paul Evans
    Commented Mar 7, 2016 at 0:13

Partial answer:$$1/\log[\sqrt4](\underbrace{\surd\surd\cdots\surd}_\text{$n$ times}2)+3-5-6+7-8+9=2^n$$Adjust the added values to get nearby integers. Also, changing the base of the logarithm and the radicand can produce powers of other numbers.



  • 7
    $\begingroup$ Mathematically speaking, this has no value. $\endgroup$
    – Arnaud D.
    Commented Mar 6, 2016 at 16:51
  • 4
    $\begingroup$ No, 0/0 is undefined. $\endgroup$
    – Deusovi
    Commented Mar 6, 2016 at 18:01
  • 1
    $\begingroup$ @Deusovi No, it's not. n/0 is undefined for n!=0, but 0/0 is indeterminate. Undefined means it never gives a number. Indeterminate means that it can give different numbers in different contexts. For instance, the limit of n/n as n approaches zero is 1, and also 0/0. The limit of 2n/n as n approaches zero is 2, and also 0/0. $\endgroup$
    – hvd
    Commented Mar 6, 2016 at 20:10
  • 5
    $\begingroup$ @hvd: Nope, 0/0 is undefined. It's an indeterminate form, which means if $\lim_{x\to c} f(x) = \lim_{x \to c} g(x) = 0$, then $\lim{x\to c} \frac{f(x)}{g(x)}$ can be any number. However, if you're not doing a limiting process, then 0/0 is undefined. $\endgroup$
    – Deusovi
    Commented Mar 6, 2016 at 22:10
  • 6
    $\begingroup$ @hvd: The limit of the quotient of two functions going to zero is indeterminate. The actual calculation "zero divided by zero" is undefined. Indeterminate forms are only a property of limits. $\endgroup$
    – Deusovi
    Commented Mar 6, 2016 at 22:59

With $n$ squareroots:


Because for any number $x$

$$\log_\frac12\left[\log_x\underbrace{\sqrt{\sqrt{\dots\sqrt{x\,}\,}\,}}_\text{n square roots}\right]\equiv n$$


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.