# For what numbers is $a_{b}= b_{a}$? (Reference?)

A student recently asked me about solutions to the equation $$a_{b} = b_{a},$$ where the subscript notation $a_{b}$ denotes interpreting the digits of $a$ in base $b$. It turns out there are tons of non-trivial solutions to this equation, such as $$36_{49} = 49_{36},$$ which can be checked since $3(49) + 6 = 153 = 4*(36) + 9$. If you allow yourself "digits" larger than 9, you get even more examples. For one, using $C$ to represent 12 as in hexadecimal, $$18C_{270} = 270_{192}.$$ Here, that 192 is the number 18C interpreted in base 10 - that is, 100 + 80 + 12. Always interpreting the bases as if they themselves were written in base 10 is a convention, but a necessary one, I think.

Anyway, my question is whether anything is known about this equation. It seems simple to state, difficult to solve, and completely useless. :) Thus, I can't get it out of my head. If it's been looked at before by anyone, I'd love a reference or ideas about it.

• This largely depends on the base you write the numbers in, in the problems, for example in the example $36_{49}=49_{36}$ that might be true, but if it was in base 16 then $24_{31}\ne31_{24}$ even though $24$ and $31$ really are just $36$ and $49$ in base $16$ – Alice Ryhl Sep 23 '14 at 19:20
• Right, so how we read the bases is a convention that we have to choose. That raises a different question - is it possible to choose that convention so we get no solutions? Should we expect the same number of solutions (in some sense) no matter which base we use to read the bases in? – coolpapa Sep 23 '14 at 19:55

Restricting myself to the 2 digit problem...

Require $pq_{xy}=xy_{pq}$ where we are working in base $d$.

$p \times (xy_d)+q=x \times (pq_d)+y$

$p \times (xd+y)+q=x \times (pd+q)+y$

$pdx+py+q=pdx+qx+y$

$py+q=qx+y$

$py-y=qx-x$

$y(p-1)=x(q-1)$

This explains why there are so many solutions: all you need is a number that can be factorised in at least two different ways.

Moving on to the 3 digit problem...

Require $pqr_{xyz}=xyz_{pqr}$ where we are working in base $d$.

$p \times (xyz_d)^2+q \times (xyz_d)+r=x \times (pqr_d)^2+y \times (pqr_d)+z$

$p (xd^2+yd+z)^2+q (xd^2+yd+z)+r=x (pd^2+qd+r)^2+y (pd^2+qd+r)+z$

$p (x^2d^4+y^2d^2+z^2+2xyd^3+2xzd^2+2yzd)+q (xd^2+yd+z)+r= x (p^2d^4+q^2d^2+r^2+2pqd^3+2prd^2+2qrd)+y (pd^2+qd+r)+z$

$px^2d^4+py^2d^2+pz^2+2pxyd^3+2pxzd^2+2pyzd+qxd^2+qyd+qz+r= xp^2d^4+xq^2d^2+xr^2+2xpqd^3+2xprd^2+2xqrd+ypd^2+yqd+yr+z$

... stopping now!