Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the sum of all four digit numbers with out zeros

share|cite|improve this question
Title mentions "repeating digits", body doesn't. Please edit for consistency. – Gerry Myerson Oct 8 '12 at 6:17

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.

share|cite|improve this answer

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)$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.