## Wednesday, May 29, 2024

### Double Digit Delights

It started with a post from Fermat's Library.

My immediate reaction was why not list them all? Giving the smallest such number suggests there are an infinite number of them. But the value of a d-digit number grows exponentially in d, while the 2-digit sum grows quadratically so there must only be a finite number.

Let's be a little more formal. Let's restrict ourselves to positive integers with no leading zeros. The 2-digit sum of x is the sum of all 2-digit numbers formed by concatenating the ith digit of x and the jth digit of x for all i,j with i$$\neq$$j. The 2-digit sum of 132 is 13+12+31+32+21+23 = 132. The 2-digit sum of 121 is 12+11+21+21+11+12 = 88. A number x if 2-idempotent if the 2-digit sum of x is x.

Let's look at the possible lengths of 2-idempotent numbers.

For 1-digit numbers the 2-digit sum is zero.

For 2-digit numbers the 2-digit sum is that number plus another positive number so never equal.

For 5-digit numbers, the 2-digit sum is bounded by 20*99 = 1980 < 10000. So there are no 2-idempotent numbers with 5-digits. More than 5 digits can be discarded similarly.

For 4-digit numbers, the two digit sum is at most 12*99 = 1188. So a 2-idempotent number must begin with a one. Which now bounds it by 19*3+91*3+99*6=924. So there are no 2-idempotent numbers of 4 digits.

So every 2-idempotent must have 3 digits. I wrote up a quick Python program and the only three 2-idempotents are 132, 264 and 396. Note that 264 is 2*132 and 396 is 3*132. That makes sense, if you double every digit and don't generate carries, every two-digit part of the sum also doubles.

Biscuit asks if there is some mathematical argument that avoids a computer or manual search. You can cut down the search space. Every length 3 2-idempotent is bounded by 6*99=594 and must be even since every digit appears in the one's position twice. But I don't know how to avoid the search completely.

Two more Python searches: 35964 is the only 3-idempotent number. If you allow leading zeros then 0594 is 2-idempotent. There may (or may not) be infinitely many such numbers.

1. A related (more natural?) definition would be the sum of all *distinct* 2-digit numbers. Of course, 11, 22, … would be 2-idempotent for this new definition and boring. But are there others?

The argument for ≥4-digit numbers carries on. Of course the argument for 2-digit numbers doesn't, but proves that the only 2-idempotent 2-digit integers are 11k for k = 1, …, 9. And for 3-digit numbers, a computer search shows that again the only possibilities are 132*k for k=1,2,3.

And for 3-idempotent numbers? You get (of course) 111*k (1 ≤ k ≤ 9), but also 8991 and 10545 (in addition to 35964).

OK, I am willing to play: the 4-idempotent numbers are 1111*k (1≤k≤9), and 255530. But no 4-idempotent number with the original definition!

1. @B., you are working with a different definition than Lance.