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.
      For your candidate 10545, your eligible summands are apparently,
      [14,15,41,45,51,54,55,104,105,140,145,150,154,155,401,405,410,415,450,451,455,501,504,505,510,514,515,540,541,545,550,551,554] --> 10545, but this is not what this is about for 3-idempotent numbers unless you assume a leading zero for the 2 digit numbers.
      However, for 35964 we have summands:

  2. interesting.

    I think generally number theorists seldom deal with digits because base 10 is kind of arbitrary after all.

    There is good amount of number theory around sum over a function applied to divisors of a number.

    I wonder if the topic of sum of a function over digits of a number in a base m is studied.

  3. For 3 digit numbers each digit appears in the sum 4 times, twice in the 10s place and twice in the 1s place so the number must be divisible by 22. Writing the number as abc, we have 22*(a+b+c) = 100*a + 10*b + c, which reduces to 26*a = 4*b + 7*c, and c must be even. Since b and c can be at most 9 the RHS can be at most 99 so a must be 1, 2, or 3. If a=1, then c can be at most 3 so must be 2 and we recover 132. If a=2, then c can be at most 7 and must be divisible by 4 so must be 4 and we recover 264. If a=3, then c must be at least 6 and cannot be divisible by 4 so must be 6 and we recover 396.