Sum of all numbers formed by the given digits

The formula for sum of all numbers formed with all the given digits is:

(Sum of digits) (n-1)!(1111....ntimes)


n stands for number of digits.

For ex: Sum of all numbers formed with 1,2,3 and 4 is 10 × 3! × 1111 = 66660.

Can anyone figure out how this was derived?

If you fix 1 in the thousands place, all other numbers can be arranged in 3! Ways.

Therefore 1 occurs in thousands place 3! Times. Same for all the numbers. Therefore for thousands place, total sum= 1000(sum) 3!.

But same thing occurs for all other positions. Therefore sum= 1111...×(sum) ×(n-1)!

• This is correct. It works as long as the digits are distinct and either none of them is zero or you include numbers starting with zero. So if the digits were $0,1,2,3$ you would have to include $0123$ and $0312$ in your sum. If the digits have a match, like $1,2,3,3$ you have fewer numbers as swapping the $3$'s doesn't produce a new number. Dec 11, 2015 at 15:04

This can also be done in another method — we get 10 if we add the digits 1,2,3,4. 4! is 24 and the number of digits is 4 so, if we divide 24 by 4 we get 6. 10×6=60. 60 will be taken in all ones tens, hundreds, thousands, ten thousands... if we add in this method we get the answer as 66660.

It'll be easier to take an example to show this.

Take for instance three numbers, 1, 3 and 7.

Now if we start thinking about all the ways the number can be arranged, we find that if we put a number say 3 in the tens position we can only keep it there as long as the other number are changing. Or in other words, 3 can only be in the tens place as long as 1 and 7 and moving around. And 1 and 7 can only move around in 2 ways or more accurately 2! ways. This will make more sense when we use our example down below.

If we try and list down all the possible three digit number it can form, it'll be something like.

137 173 317 371 713 731

Here if we follow what we talked about earlier, we'll see that for each number in a position, it'll be there only 2 times. And if this is consistent it will form a pattern in each row.

So if we look at each row, the sum of all numbers will be the same.

As we found that in this case, a number will be there 2! times, we can write down a formula to find the sum of the numbers in each row, using the following logic,

• each number will be there two times exactly
• sum of those numbers will be that number x 2 (1x2, 3x2, 7x2)
• total sum will be 1x2+3x2+7x2 or 2(1+3+7) or 2!(1+3+7) or in a general manner (n-1)!(sum of numbers)

so we've figured out the sum of each row. Now each row is different in terms of its position (ones, tens, hundreds) so when we add it will be like this. 0022 022- 22-- if we simplify this -> 22x1+22x10+22x100 taking 22 out -> 22(1+10+100) or 22(111)

so putting everything together we'll get 2!(1+3+7)(111) or generally (sum of numbers) x (n-1)! (11111... n times)

As total arrangements will be n factorial and there are n numbers.So each no. can occupy a place (n factorial/n) times then to get sum at a particular place value you have to multiply it with that place value and of course the digit. So doing it for all place values will give you a term (1111...n times) and also (sum of all digits in process) plus this all is occuring (n factorial/n) times or n-1 factorial times so take the product and there you get the result.