What is the sum of all four digit numbers with out zeros
Number problems, repeating digits without zeros
-
2Title mentions "repeating digits", body doesn't. Please edit for consistency. – 2012-10-08
2 Answers
There are $9^4$ four digit numbers which do not contain a zero (9 possibilities for each of four places).
$\frac 1 9$ of these have the digit 1 in the units place, and similarly for the tens, hundreds and thousands places.
So the total for the various positions of the digit 1 considered alone is $9^3 \times (1+10+100+1000) = 1111 \times 9^3$
Adding together the results for the digits 1, 2, 3 ... gives:$1111 \times 9^3 \times (1+2+3+\dots 9)=1111 \times 9^3\times45$
This assumes that the leading zero means that 154 would be considered as 0154 (with a leading zero) - it is not included in the sum, but the method can be adapted without difficulty to deal with this case.
We use a pairing argument.
There are $9^4$ such numbers. Let
$a=10(10)^3+(10)(10^2)+(10)(10^1)+(10)(10^0)=11110.$ It is easy to see by ordinary subtraction that if $x$ is one of our numbers, then $a-x$ also is, and that $a-(a-x)=x$. (The digits of $a-x$ are the "$10$'s complements" of the digits of $x$.)
So our numbers are (almost) divided into pairs with sum $11110$, except that $5555$ is paired with itself.
Thus there are $\dfrac{9^4-1}{2}$ "real" pairs, and the lonely $5555$. The sum is therefore $(11110)\left( \frac{9^4-1}{2}\right)+5555.$ This is $(5555)(9^4)$.
Remark: If each digit can omly be used once, the situation is even simpler. There are then $(9)(8)(7)(6)$ numbers. The pairing is the same as before, but now no one is lonely, so the sum is $(11110)\left(\dfrac{(9)(8)(7)(6)}{2} \right)$.