
Find all 10 digit numbers a0a1...a9 such that for each k, ak is the number of times that the digit k appears in the number.
Answer
6210001000
Solution
Note that a0 + a1 + ... + a9 = no. of 0s + no. of 1s + ... + no. of 9s = total no. of digits = 10. In other words the sum of the digits is 10. In particular, if i > 5, then ai = 0 or 1 (because if ai ≥ 2, then we have at least 2 digits > 5 with sum > 10).
Suppose some ai ≥ 6. Then a6 ≥ 1. But a6 ≤ 1, so a6 = 1. Hence a1 > 0. We cannot have a1 = 1, because then there are at least two 1s, so a1 ≥ 2. Contradiction. So a1 ≥ 2. We cannot have a1 = 6, because then there are six 1s and one 6, total 12, whereas all the digits only total 10. So a1 must be some other digit k > 1. But we now have at least six 0s, at least two 1s, a k and a 6, which is at least 10. So it must be exactly 10. Hence a0 = 6 and a1 = 2. So the number must be 6210001000.
So suppose all ai ≤ 5. Then in particular a0 ≤ 5, so there are at least 5 non-zero digits, and hence at least 4 of a1, a2, ... , a9 are non-zero. But that means that a1 + 2a2 + 3a3 + ... + 9a9 ≥ 1 + 2 + 3 + 4 with equality iff a1 = a2 = a3 = a4 = 1 and a5 = a6 = a7 = a8 = a9 = 0. But we must have equality because a1 + 2a2 + 3a3 + ... + 9a9 is the sum of the digits which is 10. However it is not possible to have a1 = a2 = a3 = a4 = 1 and a5 = a6 = a7 = a8 = a9 = 0 because then there are four 1s, but a4 = 1.
![]()
© John Scholes
jscholes@kalva.demon.co.uk
24 Oct 2003
Last corrected/updated 24 Oct 03