# Nonupling

My cunning plan, back last August, was sadly foiled: @christianp refused to rise to the bait.

I’d written a post about finding the smallest number such that moving its final digit to the front of the number doubles its value. It turned out, to my surprise, to be 17 digits long.

Christian, citing work commitments, declined to start a search for numbers that trebled, quadrupled, and so forth.

### Do I have to do *everything* around here? Sheesh.

The post gave two general approaches: the ungainly, but reasonable, approach of starting with a 1 at the end and writing down the appropriate multiples until just before you reached a 1 at the beginning; alternatively, a bit of algebra and Fermat’s Little Theorem found the number directly.

I prefer the algebraic method – but, as we’ll see, it hits some problems when it comes to Christian’s problem.

Let’s start with trebling. We need a number $N$ such that $N = 10a + b$ and $3N = 10^kb + a$, with $k = \lfloor \log{a} \rfloor$.

Ignoring the $k$ restriction for the moment, that gives $30a + 3b = 10^k b + a$, or $29a = \br{10^k - 3}b$. That means, $10^k \equiv 3 \pmod{29}$.

That’s (for me, at least) trickier to find than it was for the doubling case. I can work backwards, though: $3\times 10 \equiv 1 \pmod{29}$, and we know from Fermat that $10^{28} \equiv 1 \pmod{29}$ - so $10^{27} \equiv 3 \pmod {29}$.

That means we can find the number we need as $\frac{a}{b} = \frac{10^{27} - 3}{29}$, which works out to be $\frac{a}{b} = 034,482,758,620,689,655,172,413,793$. We can’t be doing with a 0 at the beginning, so we can simply let $b=3$ to give us $a=103,448,275,862,068,965,517,241,379$ and $N = 1,034,482,758,620,689,655,172,413,793$. (Not at all coincidentally, that’s very similar to the repeating digits of $\frac{3}{29}$.)

### Is that a strategy?

What’s $\frac{4}{39}$? The Mathematical Ninja would tell you that $\frac{4}{13} = 0.\dot{3}0769\dot{2}$, so $\frac{4}{39} = 0.\dot{1}0256\dot{4}$. That points to 102,564 as a candidate for quadrupling - and it does indeed work!

How about $\frac{5}{49}$? That’s $0.102040…$ and goes on for 48 digits, pointing to something in the region of $10^{48}$. However, we know that’s not the best answer! 142,857, as @panlepan pointed out in his original tweet, works just fine. (I *think* this is something to do with 49 not being prime.)

On the other hand, 59 is (as are 79 and 89), and the repeating parts of those fractions $\br{\frac{6}{59}, \frac{8}{79}, \frac{9}{89}}$ all lead you to enormous numbers with the property that multiplying them by 6, 8 and 9 respectively - I believe those are the smallest such numbers.

How about 7? 69 is not prime, but $\frac{7}{69}$ does point to a 23-digit number that becomes seven times as large when you move the last digit to the front.

Can you do any better than any of these?

* Thanks to @panlepan for the original puzzle, and to @christianp for suggesting the refinement (and generally being a good egg). * Edited 2019-09-09 to fix formatting - thanks, @shahlock!