Find the sum of all 5 digit numbers that can be formed using $0,0,1,1,2,3$.
I think this problem requires a lot of cases.The problem caused is due to the repetition of digits $0,1$ else it would have been a standard problem.Also we have to subtract the cases when $0$ comes in the ten thousands place.
Of course , a lot of brute force may yield the answer the question is how do i efficiently tackle the problem.
Background:This problem is "Pathfinder for Olympiads".This exercise comes just after an example involving calculating the sum of all 5 digit numbers using digits $0,1,2,3,4$.
Related Post Find the sum of all 4 digit numbers which are formed by the digits 1,2,5,6?
Best Answer
Maybe a simpler solution. Forget about starting zero and consider all digits equally. You have six digits, pick one and denote it with $d_i$. That digit could be first, second, ...., fifth. We have 5 remaining digits and we have to pick 4 from the set to complete the number. We can do that in $5\cdot4\cdot3\cdot2$ different ways. As you shift the digit $d_i$ from the first to the fifth place, the chosen digit contributes to the total sum with the following value:
$$d_i\cdot5\cdot4\cdot3\cdot2\cdot(10^4+10^3+10^2+10^1+10^0)$$
If you take all available digits, the total sum is:
$$(d_1+...+d_6)\cdot5\cdot4\cdot3\cdot2\cdot(10^4+10^3+10^2+10^1+10^0)=$$
$$(0+0+1+1+2+3)\cdot120\cdot11111=9333240$$
We have to avoid overcounting becuase we have two ones and two zeroes. A pair of ones doubles the total sum, and also a pair of zeroes. So if we elliminate duplicate ones and zeroes, the total sum is:
$$\frac{9333240}{2!\cdot2!}=2333310$$
The last step: we have to elliminate all numbers starting with zero. It's like asking about the total sum of 4-digit numbers made of 0,1,1,2,3 (one zero has been elliminated). If we apply the same logic, the total sum of all numbers starting with zero is:
$$\frac{(0+1+1+2+3)\cdot4\cdot3\cdot2\cdot(10^3+10^2+10^1+10^0)}{2!}=93324$$
So the final result is $2333310-93324=2239986$