I learnt the following from my son Léo: the teacher asks to compute ; that’s easy

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:

and then switch the digits on the right-hand side:

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

and we have a Léo-pair if and only if

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

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

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

the first one of these inequalities means , while the second means that …