# Find the sum of all 4 digit numbers which are formed by the digits 1,2,5,6?

I have researched and found 2 approaches but haven't understood both.Can anyone explain it clearly or probably with any real world example?

Approach 1

Four digit numbers $= 4 \cdot 3 \cdot 2 \cdot 1 = 24$ ways we can form a four digit number. Since it's a 4 digit number, each digit will appear $6= 24/4$ times in each of units, tens, hundreds, and thousands place. Therefore, the sum of digits in the units place is $6(1+2+5+6)=84$.

Why they are adding $1+2+5+6$?

Similarly sum of digits at tens,hundreds,thousands place is $84$

Required sum of all numbers $= 84+ 84 \cdot 10+ 84 \cdot 100+ 84 \cdot 1000=93324$

Approach 2

I found it here:

Find the sum of all 4-digit numbers formed by using digits 0, 2, 3, 5 and 8?

Though I have understood the 2 approaches, I am not able to understand the question.

• Consider that 123+456 = 153+426 = 156+423 = ... simply by swapping hundreds, tens, unit digits.
– sjb
Aug 14, 2015 at 11:40

In this answer I presume that all digits $1,2,5,6$ must be present in the number.

There are $4!=24$ such numbers.

We can index them with $i=1,\dots,24$ and write each of them as $$n_{i}=a_{i}+10b_{i}+100c_{i}+1000d_{i}$$ where $\left\{ a_{i},b_{i},c_{i},d_{i}\right\}=\{1,2,5,6\}$

Then $$\sum_{i=1}^{24}n_{i}=\sum_{i=1}^{24}a_{i}+10\sum_{i=1}^{24}b_{i}+100\sum_{i=1}^{24}c_{i}+1000\sum_{i=1}^{24}d_{i}$$

$\left\{ i\mid a_{i}=1\right\}$, $\left\{ i\mid a_{i}=2\right\}$, $\left\{ i\mid a_{i}=5\right\}$ and $\left\{ i\mid a_{i}=6\right\}$ have equal cardinality $\frac{24}4=6$ so: $$\sum_{i=1}^{24}a_{i}=6.1+6.2+6.5+6.6=6(1+2+5+6)=84$$

This can also be applied for $b,c$ and $d$ and finally we find: $$\sum_{i=1}^{24}n_{i}=84+10.84+100.84+1000.84=1111.84=93324$$

• No,I am afraid i haven't understood the question.Approach are nearly the same.I can calculate How many 4 digit numbers but i cannot calculate sum of all 4 digit numbers because i am not able to think what they mean by sum of all 4 digit numbers.
– Jack
Aug 14, 2015 at 11:55
• Let it be $2$-digit numbers formed by $3$ and $6$. Then there are two: $36$ and $63$. The sum of all these numbers is then $36+63$. Aug 14, 2015 at 11:58

For getting the sum of 4 digits numbers we can apply the formula as follows:-

$$(\text{sum of given digits}) \times 1~1~1~1\cdots ~n ~(\text{given number of digits}) \times (\text{number of digits}-1)!$$

eg:- to find the sum of $$~4~$$ digits using $$~2 , ~3 , ~4 , ~5~$$

sol:- $$(2+3+4+5) \times (1111)\times ( 4-1 )!$$ $$= (14 ) \times ( 1111 ) \times ( 3! )$$ $$= 14 \times 1111 \times 6$$ $$= 93324$$

We can solve by

Average of the 'smallest number formed by all digits' and 'biggest number formed by all digits'} * {Number of given digits}!

i.e for 0,2,3,5,8

Smallest number formed by using all these digits = 20358 Biggest number formed by using all these digits = 85320

Average = (20358+85320)/2 = 52839 So Answer to the given question is = 52839*5! = 6340680

for lets say 4 digit : a,b,c and d : to arrange in 4 places without repetition is 4! So each digit appears 24/4=6 times in a position - 1st, 10th, 100th and 1000th position. So sum of all digits in each position is same = 6*(a+b+c+d). let say the sum is a two digit number say ef. So now the last digit of 1st position is f. The sum of 10th position is ef again but with the carry from 1st position e. Similarly sum of 100th position is ef+carry of 10th position. And so on for 1000th position.

It has a direct formula, i.e. when there are n different digits and sum of all n digit no formed by these digits is =

$$(\text{sum of all n digits)} \times (111...n times) \times \text{n-1}!$$

It is derived by this method:

Method of expansion

Ex: $$284 = 200 + 80 + 4$$

Suppose a digit ‘a’ (one of the n digit) when placed at unit place it forms (n-1)! combinations then its digits' sum when it appears at unit place = $$(n-1)! \times 1 \times \text{a}$$

Similarly, when it appears at tens place, then sum of its digits' is = $$(n-1)! \times 10 \times \text{a}$$

.

.

Similarly, when it appears at $$n^{th}$$ place , then sum of its digits' is= $$(n-1)! \times 1000..\text{n times} \times \text{a}$$

Now, sum of all a appeared ( with their values) =

Again now sum of all no formed by permutations = Sum of all the numbers appeared like ‘a’ with their values = $$(n-1)! \times 1111..\text{n times} \times \text{sum of all n numbers}$$

Therefore, our ans for the question as follows:

For getting the sum of 4 digits numbers we can apply the formula as follows:-

$$(\text{sum of given digits}) \times 1~1~1~1\cdots ~n ~(\text{given number of digits}) \times (\text{number of digits}-1)!$$

eg:- to find the sum of $$~4~$$ digits using $$~2 , ~3 , ~4 , ~5~$$

sol:- $$(2+3+4+5) \times (1111)\times ( 4-1 )!$$ $$= 93324$$