Recently, user preshtalwalkar on Twitter posed the following
What is the sum of all 5 digit numbers using 1, 2, 3, 4, 5 without repetition?
I will present two solutions: The solution I came up with and a smart one.
My solution: Notice that at each position (the 1's, 10's, 100's, etc.) the sum of the digits is
since there are permutations each time a given digit is fixed.
Now, summing up the 1's, 10's, 100's, etc. gives
which is the solution.
The smart solution:
Note that there are permutations and at each position the average digit value is 3.
Therefore, the answer is
This is easily generalized to -digit numbers, , as
since is the average digit value and ,
which is a finite sum of a geometric progression.
The sequence is A071268 at OEIS.
We can generalize further if we consider -digit numbers using as the digits,
. We then have
where, of course, .
Feel free to leave any question, correction or comment in this