A problem in modular arithmetic
2009.03.28
Mathematics

In an New York Times Magazine article on Freeman Dyson, the following problem is posed:

Does there exist a natural number in base 10 where if you move the last digit to the front, e.g. transfrom 12345 to 51234, the new number is exactly twice of its original?
Dyson allegedly solved it in an instant, without using pencil and paper.

Here's a quick derivation of how Dyson came up with the answer that the smallest such number is 18 digits long:

Write the number as 10x + b. x represents the left-most k digits of the original number. Then the equation to solve is

2(10x + b) = 10k b + x
for some unknown k. This simplifies to
19 x = (10k - 2) b
Since b is a digit, 19 cannot divide it. This means 19 divides (10k - 2), or that
10k = 2 mod 19
Divide both sides by 2, we have
5 * 10k-1 = 1 mod 19
Since 19 is prime, it follows that 1018 = 1 mod 19. On the other hand, observe that
102 = 100 = 5 + 95 = 5 mod 19
So that in modular arithmetics, we have
102 * 10k-1 = 1018 mod 19
which says that k = 18n - 1, for some integer n. The smallest positive k then is 17. So the number must be 18 digits long (it has 17 digits in front and a single digit b in the end).

What is this number exactly? We want to solve

(1017b - 2)b = 19 x
with the requirement that x is 17 digits long. A simple calculation shows that this means
x = 5263157894736842 b
The coefficient being 16 digits long. So for any digit 1 < b < 10, we get a solution. And the smallest positive solution to the original problem is 105263157894736842, with b = 2.

We can also ask this problem more generally:

Does there exist a positive integer when expressed in base N such that moving its right-most digit to the left makes it n times larger?
It is clearn that a solution can only possibly exist if n < N. The equation we wrote down above now has the general form
(Nk - n)b = (nN - 1) x
In the case n = 1, the solution is trivial: for any positive integer k, the polynomial (N-1) is a factor for the polynomial (Nk-1), the by examine the polynomial dividend, it is clear that all the solutions are given by repeating the same digit a certain number of times.

For the case n > 1, then for a non trivial base N > 1 (in base one there is only 1 mit (as in bit/digit for binary/decimal systems), so the problem is trivial),

nN - 1 = (n-1)N + N - 1 > N
So it cannot divide b.

If nN - 1 happens to be prime, then it must then divide Nk - n, or

Nk = n mod (nN - 1)
which is an easily solvable equation as long as nN - 1 is prime.

Whether the most general case can be resolved is an exercise in abstract algebra and number theory that I am not sure I know how to do.

Posted at 17:16:04 EDT by W comment

blogCentralFront Page
2009.11.20 00:41:20 GMT Feynman's Messenger Lectures online Just found out something rather cool: Microsoft Research, through Project Tuva, is publishing videos of Richard Feynman's Messenger Lectures. Go watch.
2009.11.18 11:05:07 GMT Alcohol consumption Different cultures certainly have different views on alcohol. For example, at Hertford College Oxford, wine is allowed if reasonably drunk and 4) A small amount of beer or lager will be allowed wher
2009.11.16 19:17:31 GMT Luc visits; Willie doesn't check e-mail Holy cow! I just realized that I spent a day at work without checking e-mail! Okay, to be honest, today I was hosting Luc Nguyen, who we invited to speak on his work about the regularity near the sing
2009.11.15 18:19:32 GMT Chicken soup Chicken soup is not just good for the soul. It has been scientifically proven to mitigate inflammation. Maybe mommy's chicken soup was the reason that the same bug that took Pin out of commission for
2009.11.10 17:58:53 GMT Sayonara, e-nibbles; hullo, Gee-Mi-Ni It's final: e-nibbles is no more. e-nibbles was my trusty Dell D600 which I purchased summer after my Junior year in college through the Student Computer Initiative. Immediately after receiving the ob
2009.09.30 10:12:57 BST Ahhh! Cruft discovered in pre-print. Ack, I should've known better. I stayed up a bit later on Monday night than I intended to. I was asked, by Claude, last week, about whether certain cases (in particular the Born-Infeld model) not cove
2009.09.28 18:30:27 BST Spiders spiders everywhere Wow! Third post today, and here I thought I have been neglecting my blog. Anyway, it turns out that I am not the only person to have noticed the large number of spiders in Britain this autumn. Going o
2009.09.28 15:12:09 BST Causality of generalized wave-maps--paper on arXiv Oh, almost forgot. New paper on arXiv. Gary Gibbons showed via explicit computations using eigenvalues that the Skyrmion equation obeys the dominant energy condition. In my paper, I proved the dominan
2009.09.28 14:42:39 BST The evolution debate as an illustration of speciation I was reading some article or another in Wired, which happens to be about dinosaurs. And of course, the religious kooks came out of the woodwork to attack evolution on the comment board. And it occurr
2009.09.02 12:42:44 BST New beginnings: first days at Cambridge Heh. Did you, dear reader, notice the change on the date-stamp for the previous entry? It was posted in British Standard Time. Yes, I am now taking a position in the Department of Pure Mathematics and