Problem: Given 4 digits (1, 2, 3, 4), find the sum of all numbers formed without repeatation.
Method 1: The naive approach is to construct all 4 digit numbers formed from digits 1, 2, 3, 4 and do summation of all numbers formed.
Method 2: Here we don't have to do actual calculation. We need to think of this as mathematical + logical question. Here is the new approach:
Method 1: The naive approach is to construct all 4 digit numbers formed from digits 1, 2, 3, 4 and do summation of all numbers formed.
Method 2: Here we don't have to do actual calculation. We need to think of this as mathematical + logical question. Here is the new approach:
1. With 4 placed in units place, there are 3! permutations of 1, 2, 3 in thousandths, hundredths and tenths place. That means 4 occurs in units place 3! times. Similarly we can say that 1, 2, 3 also occur 3! times at unit place.
Therefore he sum of all numbers in units place is 3! * (4 + 3 + 2 + 1) = 6 * 10 = 60
2. Similarly, with 4 at tens position, there are 3! permutation of 1, 2, 3 in thousands, hundreds and ones place. In same way, we can say that 1, 2, 3 also occur 3! times at tens place.
Therefore he sum of all numbers in tens place is 3! * (4 + 3 + 2 + 1) = 6 * 100 = 600
The same value happens to occur in hundredths and thousandths place as well, except that it gets multiplied by a power of 10 according to its position.
So, the total should be 60 + 600 + 6000 + 60000 = 66660.