Prepend a 9 or append a 0?

143 Views Asked by At

Given a positive integer $x$, will $x$ always be larger if one prepends a 9 in comparison to appending a 0?

For x = 1, prepending is largest because $91 > 10$

For x = 9, prepending is largest because $99 > 90$

2

There are 2 best solutions below

0
On BEST ANSWER

If $a$ is an $n$-digit number, then $10^n>a$.

Then $9\cdot 10^n>9a$.

Then $9\cdot 10^n+a>10a$.

The left side of the last inequality represents prepending a $9$. The right side represents appending a $0$.

1
On

Prepending a $9$ is equivalent to changing the original number $x$ to $9*10^{\lfloor \log_{10}x\rfloor+1}+x$. Appending a $0$ is equivalent to $10x$. We then have $9*10^{\lfloor \log_{10}x\rfloor+1}+x>10x$, which simplifies to $10^{\lfloor \log_{10}x\rfloor+1}>x$, the left-hand side of which is the first power of $10$ greater than $x$, and thus greater than $x$.