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 4! 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 5!=120 permutations and at each position the average digit value is 3.
Therefore, the answer is
This is easily generalized to n-digit numbers, n≤9, as
since (n+1)/2 is the average digit value and ∑k=0n−110k=(10n−1)/9,
which is a finite sum of a geometric progression.
The sequence an is A071268 at OEIS.
We can generalize further if we consider d-digit numbers using 1,…,n as the digits,
1≤d≤n≤9. We then have
where, of course, an=bnn.
Commenting is not possible for this post, but feel free to leave a question,
correction or any comment by using the contact page