Thursday, July 16, 2009

Little Two

A number ends with the digit 2. If we move this 2 from the last position to the first, the new number is twice the original. What's the number ?

Labels:

12 Comments:

Blogger pramsay13 said...

I get 105263157894736842.
I spent a while guessing but finally had to work it out with a long sheet of paper. I'd imagine you can keep going and get a longer number, but I'd better get back to work!
p.s. did I mention I was first post?

July 16, 2009 6:53 AM  
Anonymous Chris said...

Well done. That's what I got.

July 16, 2009 8:17 AM  
Anonymous Chris said...

Here's the non trial and error approach.

Require to find 2 * N:2 = 2:N where N represents a string of n digits
and ":" means string catenation.

e.g. If N is "1234", then N:2 means 12342 and 2:N means 21234

From now on N is the value associated with the string (N).

The original problem may now be represented as:

2*(10*N + 2) = 2*10^n + N (* => mutiply, ^ => raise to power))

=> 20*N + 4 = 2*10^n + N

collecting terms and rearranging

=> 19*N = 2*10^n - 4 (equation 1)

dividing both sides of equation 1 by 19

=> N = ( 2*10^n - 4)/19 (equation 2)

Now consider equation 1 in modulo 19 arithmetic.

=> 0 = 2*10^n - 4 (mod 19)

=> 2*10^n = 4 (mod 19)

=> 10^n = 2 (mod 19) (we need to solve this for n)

Fermat proved that if a is relatively prime to prime p then a^(p-1) = 1 (mod p)
(check out Fermat's little theorem for a demonstration of this fact).


In our case 10^(19-1) = 1 (mod 19) is the useful result


Doubling both sides
=> 2 * 10^(19-1) = 2 (mod 19)

=> 2 * 10^18 = 2

=> 20 * 10^17 = 2 (mod 19)

=> (19 + 1) * 10^17 = 2 (mod 19)

=> 10^17 = 2 (mod 19)

=> n = 17 (and this is the smallest value of n which satisfies equation 1)

Substituting n = 17 into equation 2

=> N = 10526315789473684

Therefore the required (initial) number is 105263157894736842

You can add multiples of 18 to 17 (n).

e.g. n=35 => 105263157894736842105263157894736842 is the next number that satisfies the

original question.

n= 53 => 105263157894736842105263157894736842105263157894736842 is next.

'nuff

July 16, 2009 10:30 AM  
Blogger Alexander said...

you aren't supposed to take up over a foot of space, it scares away readers.

July 16, 2009 2:01 PM  
Anonymous Chris said...

Sorry about that. I had too many blank lines.

At least I didn't mention that all my answers ended with 42

July 16, 2009 4:32 PM  
Blogger Ragknot said...

1052631582 2105263158

very, very close
not exactly 2 but 1.9999999943

July 16, 2009 9:37 PM  
Anonymous skykandy19 said...

i dont understand y it has to be so difficult it dont tell you how many numbers there have to be or what those numbers are....therefore if you have a number and 2 is the last number it has to be _2 but u move that number to the first one it becomes 2_. therefore y cant the first number be 12 and the last one be 24. you still have the 2 as your last number and when you move the 2 to the first one it becomes 24 and 12+12 is 24 so u are doubling the origial amount. y does it have to be difficult.

July 24, 2009 4:51 AM  
Anonymous Chris said...

Although "_" isn't known to start with, it has to be the same
before and after moving the 2. You cannot change it from 1 to 4.

July 24, 2009 8:22 AM  
Anonymous Anonymous said...

the answer is 12 because in 12 the 2 is last.but if you double it it becomes 24

July 28, 2009 7:28 AM  
Anonymous Chris said...

Anonymous - If the starting number was 12
then when you move the 2 from the end to
the beginning you get 21, not 24.

The correct answer is 105263157894736842
because 210526315789473684 = 2 * 105263157894736842.

There is no smaller number that satisfies the original requirement.

July 28, 2009 12:48 PM  
Blogger Miguel Tato said...

I got the same result, but did it by deviding 19999...99998 by 19 (it is easy to know how to stop adding 9's and end with an 8).
Chris, your result is very elegant :)

August 30, 2009 11:06 AM  
Blogger Chris said...

Thank you Miguel. I could do it a bit better now that I've had some practice. I'd only learnt about modular arithmetic a short time ago. This was the first problem I solved using it.

October 15, 2009 8:15 PM  

Post a Comment

Links to this post:

Create a Link

<< Home