# Find the integers that double if the first and last digits are swapped

Find the integers that double if their first and last digits are swapped.

In other words find the digits: $a$, $b$ and $n_1$ ... $n_m$ in such a way that:

[$a$ $n_1$ $n_2$ ... $n_m$ $b$] $\times$ $2$ = [$b$ $n_1$ $n_2$ ... $n_m$ $a$]

For example, using the rule above: $25$ turns into $52$ but unfortunately $52 \gt 25 \times 2$. The number $102$ transforms into $201$ but again $102 \times 2 \gt 201$.

UPDATE

Possible solution:

Case 1: the number ends in $1$ and in consequence its double ends in $2$

$\ldots 1 \times 2$

$\ldots2$

In conclusion the pair must be:

$2 \ldots 1 \times 2$

$1 \ldots 2$ (impossible)

Case 2: the number ends in $2$

$4 \ldots 2 \times 2$

$2 \ldots 4$ (impossible)

Case 3:

$6 \ldots 3 \times 2$

$3 \ldots 6$ (impossible)

Case 4:

$8 \ldots 4\times 2$

$4 \ldots 8$ (impossible)

Case 5:

$0 \ldots 5 \times 2$ (the first digit can not be zero)

$5 \ldots 0$

Case 6:

$2 \ldots 6 \times 2$

$6 \ldots 2$ (impossible)

Case 7:

$4 \ldots 7 \times 2$

$7 \ldots 4$ (impossible)

Case 8:

$6 \ldots 8 \times 2$

$8 \ldots 6$ (impossible)

Case 9: the number ends in $9$

$8 \ldots 9 \times 2$

$9 \ldots 8$ (impossible)

Case 10: the number ends in $0$

$0 \ldots 0 \times 2$ (the number can not start with $0$)

$0 \ldots 0$

• Can you show there are no two digit ones? Write the starting number as $10a+b$ and apply your rule. Then try three digits and fail again. Think about what has to happen if there are more than three digits. – Ross Millikan Aug 21 '18 at 2:50
• For 10a+b, I get the condition 19a=8b, for 100a+10n1+b, I get 199a+10n1=98b. You suggest there is no solution but I do not really know how to prove it in an elegant way for the general case. – Simplex Aug 21 '18 at 3:17
• Your two digit answer is correct once you note that $a$ and $b$ have to be single digits there is no solution. Your three digit answer is not correct, it should be $10n1$. Again there is no solution in single digits. Can you see that? – Ross Millikan Aug 21 '18 at 3:22
• Finally, I believe I proved the problem does not have a solution. I updated the question with an answer. – Simplex Aug 21 '18 at 4:02
• That is a fine proof, which I encourage you to make into an answer. The FAQ encourages this as well. You miss the one trivial case of $0$ where $0\cdot 2=0$. I don't know whether that counts as swapping the first and last digits or not. After (I think) 48 hours you will be able to accept your answer. Maybe there will be one you like better by then, maybe not. – Ross Millikan Aug 21 '18 at 4:09

Given a number $l$, greater than $10$ since this is obviously not true for single digit numbers, write it as $l = 10^nx + 10y + z$, where $x$ and $z$ are single digit numbers i.e. $10^n \leq l < 10^{n+1}$. Essentially, we are isolating the first and last digits separately (for example, $166465 = 1 \times 10^5 + 6646 \times 10 + 5$)

Now, from the given condition, $2l = 10y + 10^n z + x$, since we have only swapped the last two digits. Of course, by ordinary multiplication, this is also equal to $2 \times 10^n x + 20y + 2z$, by multiplying the expression for $l$ by $2$.

Consequently, $10y + 10^n z + x = 2\times 10^n x + 20y + 2z$. A few transpositions give $10y = (10^n - 2) z - (2 \times 10^n-1)x$.

The last digit of the left hand side is $0$. Therefore, so is the last digit of the number on the right hand side. Note that $n \geq 1$, since we know $l$ has two digits. This gives the last digit of the right hand side as the last digit of $x - 2z$.

Consequently, $x - 2z$ must have last digit zero. That is, either $x = 2z$, or $x = 2z - 10$ (note that $-20 < x - 2z < 10$).

But $y \geq 0$, so $z \geq \frac{(2 \times 10^n - 1) x}{10^n - 2} \geq 2x \geq x$. So $x = 2z - 10$ is the only possibility : the other forces $x \geq z$.

But if $x = 2z - 10$ then $10 y = 10^n z - 2z - 2(10^n)(2z - 10) + 2z - 10 = - 3 \times 10 ^n z + 2 \times 10^{n+1} - 10$, and dividing by $10$ gives $y = 2 \times 10^n - 3 \times 10^{n-1}z - 1 = 10^{n-1}(20- 3z) - 1$.

This forces $z \leq 6$ from $y \geq 0$. Also, note that $2z - 10 \geq 0$ so $z \geq 5$.

Note that $z = 6$ is ruled out since this gives $x = 1$ but $x$ is the last digit of an even number, hence is even.

But if $z = 5$ then $x = 0$, but $x \neq 0$ by assumption that $10^n \leq l$.

Thus, no such $l$ exists.