# A truly amazing way of making every possible positive integer

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
• 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) Commented Apr 17, 2016 at 20:24

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: $$\text{log}[2]\left(\frac1{\frac1{2^n}}\right) = \text{log}[2]\left(2^n\right) = n$$ 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$$

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

$\dfrac{(9-8)\times(7-6)-(5-4)}{3-2-1}$

• Mathematically speaking, this has no value. Commented Mar 6, 2016 at 16:51
• No, 0/0 is undefined.
– Deusovi
Commented Mar 6, 2016 at 18:01
• @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.
– hvd
Commented Mar 6, 2016 at 20:10
• @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.
– Deusovi
Commented Mar 6, 2016 at 22:10
• @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.
– Deusovi
Commented Mar 6, 2016 at 22:59

With $n$ squareroots:

$$\log_\frac7{8+6}\left[\log_{5+\frac{4\times2}{3-1}}\sqrt{\sqrt{\dots\sqrt{9\,}\,}\,}\right]$$

Because for any number $x$

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