# Finding the sum of all four-digit numbers that can be formed using the digits $0$, $1$, $2$, $4$ without repetition

Using the digits $0$,$1$,$2$ and $4$, find the sum of all four-digit numbers that can be formed. Repetitions not allowed.

total number of $4$-digit numbers that can be formed $= 3 \cdot 3 \cdot 2 \cdot 1 = 18$ numbers.

Total number of times each digit appears$= 18/4=4.5=4$ times. But answer is wrong, although my approach of doing it isn't wrong I feel. What mistake am I doing in finding the number of times each digit appears?

• Presumably $0$ never appears in the left-most place (otherwise you get a $3$-digit number. – paw88789 Aug 25 '17 at 18:45
• neither I am taking 0 at the leftmost place @paw88789 – Sakuzi Markel Aug 25 '17 at 18:51
• 1,2 and 4 can be in the thousand place, followed by 3! ways in hundred place as 0 can also come in hundred place now, followed by 2! ways in tens place, followed by 1! way in unit place. – Sakuzi Markel Aug 25 '17 at 19:00

There are $4!=24$ numbers using the digits $0$, $1$, $2$, $4$ without repetition. Each of these digits appears $6$ times at each of the four decimal places. The sum of these $24$ numbers therefore is $(0+1+2+4)\cdot6666=46\,662$. We now have to eliminate the $6$ numbers beginning with a $0$. In these $6$ numbers each of the digits $1$, $2$, $4$ appears two times at each of the three last decimal places. The sum of the $6$ forbidden numbers therefore is $7\cdot222=1554$. It follows that the sum of all allowed numbers in this game is $46\,662-1554=45\,108$.

• 1,2 and 4 can be in the thousand place, followed by 3! ways in hundred place as 0 can also come in hundred place now, followed by 2! ways in tens place, followed by 1! way in unit place. Total ways are 18. How come 24? @ChristianBlatter – Sakuzi Markel Aug 27 '17 at 10:25
• I suggest you read my answer carefully. I start with $24$ numbers, then eliminate the $6$ forbidden ones. In this way symmetry can be exploited more easily. – Christian Blatter Aug 27 '17 at 10:36
• I read it. Can you please be more elaborate? How you came to the conclusion that there will be 24 ways? @ChristianBlatter – Sakuzi Markel Aug 27 '17 at 10:39
• I am not getting 24 ways. I am getting 18 ways. And that is what I wanted to know. How did you get 24 ways? – Sakuzi Markel Aug 27 '17 at 11:12
• @SakuziMarkel If we ignore the restriction that $0$ cannot be the leading digit, there are $4 \cdot 3 \cdot 2 \cdot 1$ ways to arrange the digits. Christian Blatter's elegant solution then eliminates the six cases in which the leading digit is $0$. – N. F. Taussig Aug 27 '17 at 11:14

Note that $1$s, $2$s and $4$s each occur $6$ times in thousands place.

In each of the other places, $0$ occurs $6$ times while each of the other digits occurs $4$ times.

• How did you find that @paw88789 – Sakuzi Markel Aug 27 '17 at 10:25
• 1,2 and 4 can be in the thousand place, followed by 3! ways in hundred place as 0 can also come in hundred place now, followed by 2! ways in tens place, followed by 1! way in unit place. Total ways are 18. How come 24? @paw88789 – Sakuzi Markel Aug 27 '17 at 10:26
• One way: just write out the 18 numbers. Another way: temporarily include the numbers with a leading 0. Now each digit appears 6 times in each column. But then when you get rid of the 0-starting numbers, you get rid of each nonzero digit twice in each no leading place. – paw88789 Aug 27 '17 at 10:52