# A breathtaking way of making every possible positive integer

This is a follow-up question to my older puzzle "A truly amazing way of making the number 2016" and to my other older puzzle "A truly amazing way of making every possible positive integer". My favorite solution to the first puzzle observed that

$~~~~2016 ~=~ (1+2+3+4+5+6+7)*8*9$.

Note that in this solution the digits occur in a neat increasing order! The solution to the second puzzle gives for every positive integer $n$ a mathematical expression that yields the value $n$ while obeying the following five rules:

1. Each of the digits $1,2,3,4,5,6,7,8,9$ is used exactly once (while digit $0$ is not used).
2. Decimal points are allowed.
3. One may use brackets "(" and ")" to structure your expression, and to make it well-defined.
4. The only allowed mathematical operations are addition (+), subtraction (-), multiplication (*), division (/); the minus sign may also be used as the sign of a negative number.
5. 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 juxtaposition of digits, non-decimal digits, cube-roots, exponentiation, factorials, absolute values, trigonometric functions, rounding, limits, etc are strictly forbidden in this puzzle.)

Now in this breathtaking follow-up puzzle, I ask you to find a solution that combines the good properties of the solutions for the two older puzzles:

New puzzle: For every positive integer $n$, find a mathematical expression

• that yields the value $n$,
• that obeys the five rules 1.-5.as listed above,
• and that contains the digits in increasing order (when read from left to right).

(The solution does not require any tricks. No lateral thinking. The expression/string can be written in a single line, with the nine digits occurring in increasing order.)

-
So wrt your $\log[b](x)$ rule - $b$ and $x$ would have to be consecutive digits, or are you letting the base slide here? – question_asker Mar 15 at 17:02
So, as in the previous one the use of n is allowed to be in the formula I'm assuming? if so there are a lot of answers that could further simplify what was done in the previous puzzle and meet the requirements of this one. – Z. Dailey Mar 15 at 17:43
I have limited mathematical background - what methods would people use to answer such a question. Would an evolutionary algorithm be used, or would a solution be discovered manually by starting with a solution and building backwards? – theideasmith Mar 16 at 1:44
would Paul's answer puzzling.stackexchange.com/questions/28444/…; work if we write $-\sqrt4+5$? – Jon Mark Perry Mar 16 at 7:36

Simple

$\kern4em\llap{ 1 } = \log\, [ 1/2 \!~ ] \Bigl( \log\, [ \!\: 3{-}4{+}5{+}6{+}7{-}8 \!~ ] \bigl( \sqrt 9 ~ \bigr) \Bigr) \raise{-2ex}\strut$
$\kern4em\llap{ 2 } = \log\, [ 1/2 \!~ ] \biggl( \log\, [ \!\: 3{-}4{+}5{+}6{+}7{-}8 \!~ ] \Bigl( \sqrt{\surd 9} ~ \Bigr) \biggr)$
$\kern4.5em \vdots$
$\kern4em\llap{ n } = \log\, [ 1/2 \!~ ] \Biggl( \log\, [ \!\: 3{-}4{+}5{+}6{+}7{-}8 \!~ ] \biggl( ~ \underbrace { \!\!\sqrt{\sqrt{\cdots\surd 9 }\,} \!\!\!\!\!\! }_n ~\quad \biggr) \Biggr)$
$\kern4em { } = \log_{\frac12} \log_{\!\; 9} \!\: 9 \!\: \raise{1.3ex}( \!\!\: \strut^\frac12 \! \raise{1.3ex})^n \raise{-3ex}\strut$
$\kern4em { } = \log_{\frac12} \bigl( \frac12 \bigr)^n$

Complex

$\kern4em\llap{ n } = \log\, [ 1/2 \!~ ] \Bigl( \log\, [ \!\: 3{+}4{+}5{-}6{-}7 \!\: ] \biggl( \sqrt{\sqrt{\cdots\sqrt{ 8{-}9 \raise{1.8ex}{\,} } \strut \,}\,} ~ \biggr) \Bigr)$

Side note

$\kern4em\llap{ \raise{.2ex}\biggl( n } = \log_{ \, \ln \!\!\: \surd e } \ln \sqrt{\sqrt{ \cdots \surd e \, }\,} \; \raise{.2ex}\biggr)$

Original

$$1 = \log[1/2] \Bigl( \log[3] \Bigl( \!\, \log[4] \, \bigl( (-5)-6+7+8 \bigr) ~\cdot~ \root\of{\surd 9 \,} \, \Bigr) \Bigr)$$ $$2 = \log[1/2] \left( \log[3] \left( \log[4] \, \bigl( (-5)-6+7+8 \bigr) ~\cdot~ \root\of{\root\of{\surd 9 \,}\,} ~\, \right) \right)$$ $$3 = \log[1/2] \left( \log[3] \left( \log[4] \, \bigl( (-5)-6+7+8 \bigr) ~\cdot~ \root\of{\root\of{\root\of{\surd 9 \,}\,}\,} ~\, \right) \right)$$ $$\vdots \qquad\qquad$$ $$\begin{array}{rl} n \kern-1em & = \: \log_{\frac12} \log_3 \raise{.5ex}\Bigl( \bigl( \log_4 4 \bigr) \root\of {9 \,} ^{ \bigl( \frac12 \bigr)^n } \; \raise{.5ex}\Bigr) \\[1ex] & = \: \log_{\frac12} \log_3 \raise{.5ex}\Bigl( 3^{ \bigl( \frac12 \bigr)^n } \; \raise{.5ex}\Bigr) \\[1ex] & = \: \log_{\frac12} \left( \frac12 \right)^n \end{array}$$

-

$n = \log [1 - 2 + 3]\left(\left(-4 + 5\right)\text{/}\left({\log\left[\sqrt{-6 + 7 + 8}\right]\left(\sqrt {\sqrt {\ldots\sqrt { \sqrt9}}}\right)}\right)\right)$
$\;\;\;= \log[2]\left(1/\left(\log[3]\left(\underbrace{\sqrt {\sqrt {\ldots\sqrt3}}}_{\text{$\sqrt{\phantom0}$repeated$n$times}}\right)\right)\right)$
$\;\;\;= \log_2\left(1/\left(\log_3\left(3^\frac1{2^n}\right)\right)\right)$
$\;\;\;= \log_2\left(1/\left(\frac1{2^n}\right)\right)$
$\;\;\;= \log_2\left(2^n\right)$
$\;\;\;= n$
Also, by using no repetitions of $\sqrt{\phantom0}$ (as per the second line) we get $n = 0$
Likewise, by substituting the $/$ with $\cdot$ we get, as a bonus, $-n$ for all $n$ repetitions of $\sqrt{\phantom0}$

-

$\kern4em\llap{ 1 } = \log\, [ (1+2+3+4)/5 \!~ ] \Bigl( \log\, [ \!\: \sqrt{-6+7+8} \!~ ] (9) \Bigr) \raise{-2ex}\strut$
$\kern4em\llap{ 2 } = \log\, [ (1+2+3+4)/5 \!~ ] \Bigl( \log\, [ \!\: \sqrt{\surd-6+7+8} \!~ ] (9) \Bigr) \raise{-2ex}\strut$
$\kern4.5em \vdots$
$\kern4.5em \vdots$
$\kern4em\llap{ n } = \log\, [ (1+2+3+4)/5 \!~ ] \Bigl( \log\, [ \!\: \underbrace { \!\!\sqrt{\sqrt{\cdots\surd-6+7+8}}}_n \!~ ] (9) \Bigr) \raise{-2ex}\strut$