# math problem

Here’s a question that they just put in my company newsletter.
I’m not quite sure how to start at it without just going through every number. Any ideas?

What is the smallest number where if you move the last digit to the first (in other words 1234 becomes 4123) the new number is 3 times the size of the original number.

Okay thius will make it alot simple for you:

The first and last digit of the number must be either both odd or both even, this will narrow your search (with this in mind I checked all the numbers from 1-100 in my head and unless I made a mistake the number is greater than 100)

1. The first digit of the original number has to be a three or less, and the last digit has to be three or more. The last digit must also be between three times and two plus three times the first. (if the first digit is 2, the last can only be 6,7 or 8, and if the first digit is three, the last can only be 9, since to go high would mean adding another digit)

2. The last and next-to-last digits are related. If the last is 3, the next to last must be 9, and so on (4,2)(5,5)(7,1)(9,7). This means the answer must end with 17, 24, 55, 79 or 93.

This cuts down the possibilities considerably. In trying 4-digit numbers, there are only 30 possibilities in the 1000-1999 range, 20 in the 2000-2999 range, and 10 in the 3000-3999 range. I’ll give 'em a quick scan and see if anything comes up.
Running through some of the numbers that that allows, I know the answer’s not a two-digit or three-digit number.

I screwed something up with part 2 there. the last two digits have to be 17, 24, 48, 55, 79, 86 or 93. I don’t know why I left those extra two out.

Gimme a few more minutes.

Here’s how I did it:

Express the number as 10a+b. Three times this is 30a+3b, which we know is also 10[sup]c[/sup]b+a:

30a+3b = 10[sup]c[/sup]b+a

and we get:

a = (10[sup]c[/sup]-3)b/29

a, b, and c are all integers, so 29 must divide 10[sup]c[/sup]-3 = 999…997.

This part gets a little tedious–either use a calculator, or use long hand division to find the smallest number of the form 999…997 which is divisible by 29. You should get:

999999999999999999999999997 = 29*34482758620689655172413793

And so we have

a=34482758620689655172413793b

A quick check rules out b=1 and 2 (otherwise, three times the original number gives an extra digit, and we can’t have that).

b=3, a=103448275862068965517241379

gives the smallest solution:

1034482758620689655172413793 * 3 = 3103448275862068965517241379.

How about 0? Write it as 0.0 (or however you want to), flip it around so it’s still 0.0, and then 3*0 = 0.

Although Cabbage’s solution is rather nice.

Hmm… I’m not finding a four-digit answer, either. This’ll take a while.

Either that or I screwed up something really obvious. Wouldn’t be the first time.

Now that I see Cabbage’s answer, I see it’ll take more that brute force and a pencil and paper. Nicely done.

Following Cabbage’s clever algorithm:

9999999997 / 29 = 3448275862 (That’s 10 9s followed by a 7.)

Unless of course, it isn’t… belay that order.

Well, the fact that 29 divides 10^k - 3 is equivalent to
10^k = 3 (mod 29).

Now a congruence like this does not necessarily have a solution unless 10 is what is called a primitive root mod 29. In that case, the solution is unique mod 28, that is there is one solution between 0 and 28 and any two solutions differ by a multiple of 28. If 10 is not a primitive root, then there may be many solutions or none. Since there is already one, k = 27, this will be the smallest only if 10 is a primitive root. It took a few computations (have to check if any of 10^2, 10^4, 10^7, or 10^14 is = 1 (mod 29)) but not that hard and indeed it is true that 10^27 - 3 is the smallest. The next one is 10^55 - 3 and so on.

I thought I’d add one more thing:

You can construct your own numbers of this type by playing around with 'em. For example, Sublight was definitely on the right track with one of his remarks, about the number ending in either 17, 24, 55, 79 or 93.

Let’s assume the number ends in 3 (other choices may work as well, but we now know they won’t give you the smallest number). As Sublight mentioned, this forces the next digit to be 9 (3*3=9).

93*3 = 279, so the next digit must be 7.

793*3 = 2379, so the next digit is 3.

3793*3=11379, so the next digit is 1.

13793*3=41379, so the next digit is 4.

And so on…

Stop it when you get a number that works.

For another example, say, “What is the smallest number where if you move the last digit to the first (in other words 1234 becomes 4123) the new number is 2 times the size of the original number?”

I happen to know the smallest such number ends in 2 (but try another number if you like):

2*2=4, so the next digit is 4.

42*2=84, so the next digit is 8.

842*2=1684.

6842*2=13684

36842*2=73684

736842*2=1473684

4736842*2=9473684

94736842*2=189473684

894736842*2=1789473684

7894736842*2=15789473684

57894736842*2=115789473684

157894736842*2=315789473684

3157894736842*2=6315789473684

63157894736842*2=126315789473684

263157894736842*2=526315789473684

5263157894736842*2=10526315789473684

105263157894736842*2 = 210526315789473684

i tried using excel to solve it, but it doesn’t seem to handle numbers bigger than 999 trillion without rounding down the smaller numbers… in any case the answer is either zero or something bigger than 999 trillion, such as Cabbage’s answer.

Does it have to be whole number? If not,
.103448275862069 works.

.103448275862069 x 3 =.310344827586207

with some rounding, it works for what is asked. (Notice the similarities between this number and Cabbages?)
You can find a “parasite number” with d * as the multiplier with the formula d/(10d*-1). This will give you the lowest number for a “d-parasite”

This is courtesy of Wonders of Numbers
by Clifford Pickover. Chapter 80 is Parasite Numbers, and deals with this problem specifically.