## Permuted Sums

#### Problem

Four digits are selected from the set {1,2,3,4,5} to form a 4-digit number.

Find the sum of all possible permutations.

#### Solution

There are exactly five sets of four that can be selected (^{5}C_{4}=5):

1234, 1235, 1245, 1345, 2345

For each combination there are 4! = 24 combinations. Hence there are 524 = 120 different 4-digit numbers that can be formed.

Imagine placing each of these 4-digit numbers on top of each other in a long list to be added manually. Each of the digits 1, 2, 3, 4, and 5 will appear equally often in each of the units, tens, hundred, and thousands columns. There are two ways to proceed...

__Method 1__

As 120/5 = 24, each digit will contain twenty-four occurrences of each digit and so each column would add to 24(1+2+3+4+5) = 360.

In adding the units column we write 0 and carry 36.

In the ten colums we get 360+36 = 396: write 6 and carry 39.

In the hundred and thousands column we get 360+39 = 393: write 9 and carry 39.

Hence the sum is 39 9 9 6 0 = 399,960.

__Method 2__

As the mean digit in each column is 3, each number is 3333, on average. Hence the sum is 1203333 = 399,960.

Find the sum of all possible permutations of `k` digits taken from {1,2,3,...,`n`}.