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.

  • $\begingroup$ Should i be more elaborate in my answer? $\endgroup$ – Akshaj Bansal Sep 15 '19 at 14:46
  • $\begingroup$ @AkshajBansal that would help a lot especially if you consider all digits in there! $\endgroup$ – Emad Sep 15 '19 at 14:50
  • $\begingroup$ Do u wnt an answer when we consider $0,1,2,3,4,5,6,7,8,9$ as digits for the 4 digit numbers? $\endgroup$ – Akshaj Bansal Sep 15 '19 at 14:52
  • $\begingroup$ @AkshajBansal yes just as the title suggests, I used 4 digits so that I could write down all of the digits myself and use it to find the formula for the general case. $\endgroup$ – Emad Sep 15 '19 at 14:53
  • $\begingroup$ Repetition not allowed ,right? $\endgroup$ – Akshaj Bansal Sep 15 '19 at 14:54

Take the $k$th column place. For every digit $a$ in the $k$th columns there should be $9*8*7$ digits in the remaining three columns. $a$ appears in the $k$th column $9*8*7$ times. So if you add up all the terms in the $k$ths column you should get $9*8*7(0+1+2+..... + 9) = 45*9*8*7$ and so the $k$th column provides $45*9*8*7*10^{k-1}$ to the sum. So the total sum should be $45*9*8*7(10^3 + 10^2 + 10 + 1) = 45*9*8*7*1111$.

Except that adds up "four digit" numbers that have $0$ in the thousands column which should not be included.

So.... we subtract the sum of all strings that start with $0$.

Now by the same reasoning, if $a$ is in the $k$th column there are $8*7$ options for the remaining two columns (they can't be zero) so the sum of all those strings is $8*7*(1+2+3+ ..... + 9)*(10^2 + 10 + 1)= 45*8*7*111$.

So our sum is $ 45*9*8*7*1111- 45*8*7*111 = 45*8*7(9999-111)=45*8*7*9888$

| cite | improve this answer | |
  • $\begingroup$ that is true and the answer also matches my book's.thank you! $\endgroup$ – Emad Sep 15 '19 at 16:43

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 .


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

| cite | improve this answer | |
  • $\begingroup$ I know that and besides I used the digits 0,1,2,3 to find a formula for the real question which is the sum of all 4 digits with distinct digits. $\endgroup$ – Emad Sep 15 '19 at 14:48

You've done well so far. You're getting stuck where you assign a digit to one of the places other than the $1000$'s place. Note that if you assign $0$, it contributes nothing to the sum, so you can ignore that possibility.

Once you've assigned a non-zero digit, you have to assign $3$ more, but you can't assign $0$ to the $1000$'s place. So, calculate the number of ways to assign the three digits, without regard to the restriction, and then subtract the number of ways to assign $0$ to the $1000$'s place.


There are $9$ ways to assign a non-zero digit to a place other than the $1000$'s place. That leaves you with $9$ digits to assign to $3$ places, which can be done in $9\cdot8\cdot7$ ways. We have to subtract the $8\cdot7$ ways where we assigned $0$ to the $1000$'s place, giving $9\cdot8\cdot7-8\cdot7=8\cdot8\cdot7=448$ ways.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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