I need to find the sum of all 4536 numbers with distinct digits from 1000 to 10000 (so 4 digit numbers). Now, I developed a primary method for a solution but its too time consuming! anybody have any clever ideas?
I think the purpose is for you to work this out on your own. But I will get you on the right path.No. Do it analytically please.
I think that both myself and Xitami left out some detail for FryerMath to fill in. I just gave the sum of the digits in the thousands position 45*9*8*7. I see FryerMath knew to multiply that figure by 1000. I was hoping he would see how to arrive at the figure 45*8*8*7 for the sum of the digits in the 100's position himself. As you say a similar analysis such as you gave should apply to the 10's and 1's digit sums.I think that Xitami has the right idea, but left out some details. Let's consider
[tex]abcd = 10^3 a + 10^2 b + 10 c + d[/tex]
where a, b, c, d are distinct integers between 0 and 9, and [itex]a \neq 0[/itex]. The problem is to sum all numbers abcd that meet these conditions. First, we sum the contributions from the leading digit. The leading digit can take any of the values 1, 2, ..., 9. For any choice of the leading digits there are 9x8x7 = 504 choices for the next three digits. Therefore, the sum of the leading digits is
[tex]1 \cdot 10^3 \cdot 504 + 2 \cdot 10^3 \cdot 504 + \cdots + 9 \cdot 10^3 \cdot 504 = 45 \cdot 504 \cdot 10^3[/tex]
Next we consider the contribution of the second digit to the sum. The second digit b can take any of the 10 values 0, 1, ..., 9. If b = 0, then there are again 9x8x7 choices for the remaining digits. For each choice of b = 1, 2, ..., 9, there are 8 possibilities for a (since a can't equal 0), 8 choices for c (since c can equal 0) and 7 choices for d, a total of 8x8x7 = 448. If b = 0, it contributes nothing to the sum, so we may disregard it. Therefore, the total contribution of the second digit to the sum is
[tex]1 \cdot 10^2 \cdot 448 + 2 \cdot 10^2 \cdot 448 + \cdots + 9 \cdot 10^2 \cdot 448 = 45 \cdot 448 \cdot 10^2[/tex]
The contributions of the third and fourth digits to the sum are handled similarly. I'll let you work it out from here. Post your final answer and I'll tell you if it agrees with mine.
I think Petek, Xitami and I each came up with 24,917,760 as the answer. Using your method I would put it at 1111*45*9!/(9-3)! - 111*45*9!/(9-2)! + 11*45*9!/(9-1)! -45 or 24,842,250 which is your answer. I am not sure why your method gives a different answer, but I am certain that 1000*45*9*8*7 + 111*45*8*8*7 which equals 24,917,760 is the correct answer.My way:
If we allow for leading zeros (the numbers 0123-9876) the solution is quite obviously 4999.5 * 10!/(10-4)! (because every digit at every place is equiprobable)
so if we just subtract off the 3 digit numbers we're good.
We can calculate 3 digit numbers with the same method as above but this includes 2 digit numbers that aren't included in the 4 digit calculation... and so on...
the final calculation is thus:
4999.5 * 10!/(10-4)! - 499.5 * 10!/(10-3)! + 49.5 * 10!/(10-2)! - 4.5 * 10!/(10-1)!