The sum of all 4 digit numbers with distinct digits

combinatorics

I tried solving this problem and got into a little trouble.I had done questions similar to this one before where the digits(that I could use) were specified so I thought maybe I could solve it like them. so I started writing all 4 digit numbers with distinct digits using the digits: $${0,1,2,3}$$
and I found the number of occurrence of each digit in units place, then the 10's place ,100's place and finally the 1000's place and I got this as the sum of all numbers : $$4\times(0+1+2+3)\times(1+10+100) + 6 \times (1+2+3) \times 1000$$
and with some more thought into it I found out that I could Write the sum of the numbers in the form $$(A\times(0+1+…+9) \times 111)+(B\times (1+2+…+9)\times 1000)$$
now my question arises I'm able to find the value of B which is just $9 \times9\times8\times7$ devided by $9$ which is $9\times8\times7$ but I really can't find the Value of A because it seems to have no relations with the value of $9 \times9\times8\times7$ so I could use some help here; or maybe what I've done is not the best way of doing it. I will appreciate your answers.

Best Answer

Think like this For the sum of all digits at thousands place the expression would be

$1000(1+2+3+4+5+6+7+8+9)×{9\choose3}×3!.$ Explanation- You surely dont have $0$ therefore now only $9$ possibilities left for thousands place suppose you take $1$ at thousands place now you need to see how many times does it repeat i.e $9\choose3$ since you need to select $3$ digits out of $9$(0,2,3...9) possibilites also you need to see in how many ways those $3$ would be arranged that is $3!$

Now- For hundreds, tens, units place there would be two separate cases for $0$ coming at those places and ${1,2,3...9}$ coming at those places. For $0$ we see it repeats $9×8×7$ times (but it doesnt affect the sum) For digits ${1,2,...9}$ they repeat $8×8×7$ times ,now how does that come since you dont have $0$ at thousanda place so only $8$ possibilities and for other place $8$ possibilities again (since you can put $0$) now and $7$ possibilities for the last place .

$9×8×7(0)(111)+8×8×7(1+2+3+4+5+6+7+8+9)(111)$$

And the final answer-

$\big(1000(1+2+3+4+5+6+7+8+9)×{9\choose3}×3!\big)+ \big(8×8×7(1+2+3+4+5+6+7+8+9)(111)\big)$ $=1000×9×8×7×45+8×8×7×45×111=24917760$

Or According to your question
$A$ is $8×8×7$ and $B$ is $9×8×7$

Thank you