Suppose we would like to find positive integers $n$ such that the base-10 representations of $n$ and $2n$ contain precisely the same digits.

$142857$ is a well-known example, and computer search quickly produces many others, of which the smallest is $125874$. In fact, there are 12 solutions of 6 digits, all of which are permutations of $125874$; if one allows leading zeroes, there are 36 other solutions less than 1000000, all permutations of $0142857$. (For example, the smallest such is $0512874$.)

There are larger solutions that are a bit different, but they all seem to contain the digits 1, 4, 2, 8, 5, and 7 exactly once each. (Computer search verifies this for $n$ up to $63.6\cdot 10^6$, by which point there have been $6000$ solutions, each one containing 1,4,2,8,5, and 7 exactly once each.) Obviously there are larger solutions that contain each of 1, 4, 2, 8, 5, and 7 exactly twice each, obtained by concatenating two smaller solutions, but the pattern of $124578$ appearing as a group seems to persist. For example, the largest solution less than $10^8$ is $09875421$.

In other bases, there are much simpler solutions. For example $52_8 = 2\cdot 25_8$.

My overall question is:

What is going on here?

But in case that is too vague, here are some more specific questions:

  1. Although I don't know an argument offhand, it's easy to imagine that there could be an algebraic argument showing that $142857$ has this property, since $142857$ is the useful number $\frac1n{\bigl(10^{n-1}-1\bigr)}$ for $n=7$. But why should all the other small solutions be permutations of this number? In particular, is there a way to deduce, without exhaustive search, that the minimal positive solution is $125874$? Or that any solution must contain the digits $1,2,4,5,7,$ and $8$, and so the minimal solution must be at least $124578$?

  2. Other digits appear mixed into the $124857$ digits. For example, $12457899, 12356784,$ and $49712859$ are solutions. But none of $1,2,4,5,7,$ or $8$ seems to appear in a solution except a part of a group. Is it the case that every solution contains an equal number of each of these 6 digits?

  3. Solutions in base 8 do not show so much regularity. The digits 3 and 6 always appear together, as do the digits 1 and 4. (5 and 2 are not closely coupled in this way; for example $1042_8\cdot 2 =2104_8$.) What is the difference between the base 8 and the base 10 situation? In base 16, $08124$ and similar numerals are solutions, which is suggestive, but I'm not sure of what.


2 Answers 2


I have a partial explanation, which I'll write up in more detail later on. I do have method that would allow someone to find a 6-digit base-10 solution in a reasonable amount of time with only pencil and paper; perhaps 30–60 minutes. (The difficulty is that there are no small solutions in base 10; it takes time to find this out, and then to perform the analysis for $n=6$.)


  1. There are solutions in base 10 that do not include a group of 124578.
  2. I can prove that smallest such has at least 10 digits.
  3. An example is 4,225,561,128. The example 1,577,438,874 completely refutes amy theories about 124578 always appearing in groups.

I do not yet have any good explanation for why the 6 common digits are 124578, or whether the appearance of $\frac17(10^6-1)$ is a coincidence.

[ Added 2014-06-11: This is written up on the math.se blog. The short explanation of the behavior is that there are fairly strict conditions on the set of digits that can appear in a solution, but if these conditions are satisfied, the order of the digits is only weakly constrained, because the question only asks for a number where the digits of $2N$ are in some order. ]


Working modulo 9, we have your $\{1,2,4,8,7,5\}$ as $$2^0=1, 2^1=2, 2^2=4, 2^3=8, 2^4=7, 2^5=5, 2^6=1$$

I don't have a direct connection between this observation and your data, but I would conjecture that if we worked in base 12 rather than base 10, we would take mod $11$ and then all the digits would appear much more often.

  • $\begingroup$ This seems related to the fact that 3 and 6, when they do appear, always appear together; we have $3\cdot 2 = 6$ and $6\cdot 2 = 3\pmod 9$. On the other hand, 3 and 6 also appear together in base 8, where we would not expect it, since $6\cdot 2\not\equiv 3\pmod 7$. $\endgroup$
    – MJD
    May 5, 2014 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.