I hope that I am wrong. How about that?
But I think that this is really a programming question as opposed to a mathematical problem.
I really donít see it as otherwise. But number theory is my weakness.
There are 120 five-digit numbers that can be formed by permuting the digits 1,2,3,4 and 5 (for example, 12345, 13254, 52431). What is the sum of all of these numbers?
I can't get this question...I don't know what to do...
All I think of doing is 120P5 = 2.29 x 10^10 .... but that's wrong
Ah, this is a very nice problem, and there is an elegant solution.
For each permutation, there is another one that can be added to it so that the sum equals 66666.
Examples: For 12345, there exists exactly one other permutation that sums with it to 66666, and that is 54321.
For 13245 it is 53421, for 34251 it is 32415.
I don't have a formal proof for this, but after some consideration it does seem very intuitively correct.
Therefore, since we have sixty pairs of these permutations, the sum is 66666*60 = 399960.
(12345 + 54321) = 66666,
(12354 + 54312) = 66666,
(12534 + 54132) = 66666,
I'm quite surprised I found this, I usually miss this kind of stuff.
There's no quick formula for this.
Imagine listing the 120 permutations . . .There are 120 five-digit numbers that can be formed by permuting
. . the digits 1,2,3,4 and 5. .(Examples: 12345, 13254, 52431).
What is the sum of all of these numbers?
We will find that, in each column, the 1 appears of the time: 24 times,
. . the 2 appears 24 times,
. . the 3 appears 24 times, etc.
So each column adds up to: .
Now add them up!