Let the number of digits of x be d, the leading digit of x be 1≤a≤9 and the remaining d−1 digits be 1≤b≤10d−1. There is no solution with d=1, so we can assume d>1. Then the equations to solve are:
x3x=10d−1a+b=10b+a
As 3x has the same number of digits as x, the leading digit of x must be a=1,2 or 3. Eliminating x, we obtain
a(3⋅10d−1−1)=7b.
As b has d−1 digits, we have b<10d−1, which gives (3a−7)10d−1<a. Because d>1 we can now exclude a=3, so we must have a=1 or a=2. As 1≤a≤3 it also follows that 7 divides 3⋅10d−1−1, so that
10d≡3⋅10d−1≡1(mod7).
Checking powers of 10 (mod 7), we confirm that 10 is a primitive root and so 10d≡1(mod7) if and only if d≡0(mod6). So let us write d=6c for an integer c>0, then solutions must take the form:
b=7a(3⋅106c−1−1)with c>0 and a∈{1,2}.
Adding the initial digit, we have:
x=106c−1a+7a(3⋅106c−1−1)=7a(7⋅106c−1+3⋅106c−1−1)=7a(106c−1)=106−1106c−1⋅7106−1⋅a=106−1106c−1⋅142857⋅a.
For any c≥1, we note that (106c−1)/(10c−1)=∑k=0c−1106k consists of c ones, each separated by five zeros. Because 2⋅142857=285714 the solutions to the problem are numbers of the following form:
142857 repeated c times and 285714 repeated c times, c≥1.