I learnt the following from my son Léo: the teacher asks to compute
; that’s easy
![9\ +\ 9\ =\ 18. 9\ +\ 9\ =\ 18.](https://s0.wp.com/latex.php?latex=9%5C+%2B%5C+9%5C+%3D%5C+18.&bg=ffffff&fg=000000&s=0)
But no! The actual question is to compute
times
! We must correct this! But it’s just as easy without starting from scratch: we turn the “plus” cross a quarter turn on the left-hand side:
![9\ \times\ 9 9\ \times\ 9](https://s0.wp.com/latex.php?latex=9%5C+%5Ctimes%5C+9&bg=ffffff&fg=000000&s=0)
and then switch the digits on the right-hand side:
![9\ \times\ 9\ =\ 81. 9\ \times\ 9\ =\ 81.](https://s0.wp.com/latex.php?latex=9%5C+%5Ctimes%5C+9%5C+%3D%5C+81.&bg=ffffff&fg=000000&s=0)
This is a fun little random fact about integers and decimal expansions, certainly.
But there’s a bit more to it than that: it is in fact independent of the choice of base
, in the sense that if we pick any other integer
, and consider base
expansions, then we also have
as well as
(where we underline individual digits in base
expansion.)
At this point it is natural to ask if there are any other Léo-pairs
to base
, i.e., pairs of digits in base
such that the base
expansions of the sum and the product of
and
are related by switching the two digits (where we always get two digits in the result by viewing a one-digit result
as
).
It turns out that, whatever the base
, the only such pairs are
and the “degenerate” case
.
To see this, there are two cases: either the addition
leads to a carry, or not.
If it does, this means that
where
. The sum is then
So this is a Léo-pair if and only if
This equation, in terms of
and
, becomes
which holds if and only if
. Since the factors are integers and non-negative, this is only possible if
, which means
, the solution found by Léo.
Now suppose there is no carry. This means that we have
and
. Then
![x+y=\underline{0}\,\underline{x+y}, x+y=\underline{0}\,\underline{x+y},](https://s0.wp.com/latex.php?latex=x%2By%3D%5Cunderline%7B0%7D%5C%2C%5Cunderline%7Bx%2By%7D%2C&bg=ffffff&fg=000000&s=0)
and we have a Léo-pair if and only if
![xy=\underline{x+y}\,\underline{0}, xy=\underline{x+y}\,\underline{0},](https://s0.wp.com/latex.php?latex=xy%3D%5Cunderline%7Bx%2By%7D%5C%2C%5Cunderline%7B0%7D%2C&bg=ffffff&fg=000000&s=0)
i.e., if and only if
.
This is not an uninteresting little equation! For a fixed
(which could now be any non-zero rational), this defines a simple quadratic curve. Without the restrictions on the size of the solution
, there is always a point on this curve, namely
![(x_0,y_0)=(2b,2b). (x_0,y_0)=(2b,2b).](https://s0.wp.com/latex.php?latex=%28x_0%2Cy_0%29%3D%282b%2C2b%29.&bg=ffffff&fg=000000&s=0)
This does not fit our conditions, of course. But we can use it to find all other integral solutions, as usual for quadratic curves. First, any line through
intersects the curve in a a second point, which has rational coordinates if the line is also defined by rational coefficients, and conversely.
Doing this, some re-arranging and checking leads to the parameterization
of the rational solutions to
, where
is an arbitrary non-zero rational number. In this case, this can also be found more easily by simply writing the equation in the form
![0=xy-bx-by=(x-b)(y-b)-b^2\ldots 0=xy-bx-by=(x-b)(y-b)-b^2\ldots](https://s0.wp.com/latex.php?latex=0%3Dxy-bx-by%3D%28x-b%29%28y-b%29-b%5E2%5Cldots&bg=ffffff&fg=000000&s=0)
Now assume that
is an integer, and we want
to be integers. This holds if and only if
is an integer such that
.
Such solutions certainly exist, but do they satisfy the digit condition? The answer is yes if and only if
, which means
, giving the expected degenerate pair. Indeed, to have
, the parameter
must be a negative divisor of
. We write
with
positive. Then to have non-negative digits, we must have
![\begin{cases} x=b-d\geq 0\\ y=b-\frac{b^2}{d}\geq 0\end{cases}, \begin{cases} x=b-d\geq 0\\ y=b-\frac{b^2}{d}\geq 0\end{cases},](https://s0.wp.com/latex.php?latex=%5Cbegin%7Bcases%7D+x%3Db-d%5Cgeq+0%5C%5C+y%3Db-%5Cfrac%7Bb%5E2%7D%7Bd%7D%5Cgeq+0%5Cend%7Bcases%7D%2C&bg=ffffff&fg=000000&s=0)
the first one of these inequalities means
, while the second means that
…