# How to calculate the sum of the total set of numbers from a set of digits (without repetition)?

The question seems fairly complicated but let me break it down:

For example, you are to calculate the sum of the possible 4 digit numbers of the digits 1,2,3,4 without repetition. So all the numbers 1234,1243, 1324,1342, etc will be all added together to make one large number. Obviously this can be done by adding all 24 possible combinations and adding them together one by one. The answer to this is 66660 which is somewhat of a special number.

But lets say that we are doing this with the digits 3,4,5,6,7 and you need to figure out the sum to all possible combinations without repetition. What would be the simplest way to do this?

In conclusion, what I'm trying to ask is how would you calculate the sum of this set of numbers is there a way to do it for any set? Say 3,8,1,6 in 4 digit numbers.

(I have no idea what tag to use)

• Your example seems a bit broken, please review and fix. For example you say that you are using $1,2,3,4$ but then use $5$. And other issues. – Joffan Feb 19 '18 at 22:25

You are right to suspect that the 'niceness' of $66660$ was no coincidence ... Given that each number occurs in each of the four positions (I am assuming you working with the four digits 1,2,3,4 here) a total of $3!=6$ times, and given that the sum of the digits is $10$, we get a total of $6 \cdot 10 \cdot(1+10+100+1000)=60\cdot 1111=66660$
Likewise, if the digits are $3,4,5,6,7$, then the total will be:
$$4! \cdot (3+4+5+6+7)\cdot 11111=6666600$$
For four digits $3,8,1,6$ you get:
$$3! \cdot (3+8+1+6) \cdot 1111=119988$$