Sum of Numbers with distinct digiits?!


by FryerMath
Tags: digit, distinct, number theory, sum
FryerMath
FryerMath is offline
#1
Apr6-11, 07:01 PM
P: 5
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?
Phys.Org News Partner Science news on Phys.org
NASA's space station Robonaut finally getting legs
Free the seed: OSSI nurtures growing plants without patent barriers
Going nuts? Turkey looks to pistachios to heat new eco-city
gb7nash
gb7nash is offline
#2
Apr6-11, 07:28 PM
HW Helper
P: 805
Are you allowed to make a program that calculates it?
FryerMath
FryerMath is offline
#3
Apr6-11, 08:16 PM
P: 5
No. Do it analytically please.

ramsey2879
ramsey2879 is offline
#4
Apr6-11, 09:04 PM
P: 891

Sum of Numbers with distinct digiits?!


Quote Quote by FryerMath View Post
No. Do it analytically please.
I think the purpose is for you to work this out on your own. But I will get you on the right path.
Suppose you write the numbers down twice only in two columns. In the first column write then in the order 1000, 1001, 1002 ... 9999. In the second column you assume the numbers are written in reversed order. If I understand you there should be 9000 numbers in each column, not the 4536 total you mentioned in your post. Now suppose you add the pair in each row and put in column 3: 1000 + 9999 = 10999; 1001 + 9998 = 10999; 1002 + 9997 = 10999; ... 9999+1000 = 10999.

How many 10999's will ther be in column 3 when you are done.
What is the sum of these 10999's represent ( in respect to the sums of the numbers in columns 1 and 2)?
Edit OK I think I see why there are only 4536 total numbers. Each of the four digits must be distinct!! That calls for a more specific solution.
With each digit from 1 to 9 in the thousands position you have 9*7*6 total ways to write the remaining digits. So the total of the sum of the digits in the thousands position will be T(9) * 9*8*7 or 45*9*8*7. You use a slightly different method to total the digits from 1 to 9 in the 100's, 10's and 1's positions. Zeros dont count in the sum but they figure in the determination of how many of each digit there would be in the 1000's, 100's or 10's or 1's.
FryerMath
FryerMath is offline
#5
Apr6-11, 10:31 PM
P: 5
No, sorry. The digits of the numbers have to be distinct
doing what you explained would be a lot easier though
just use n(n+1)/2 from 1-10,000 and then again from 1-1000 and subtract the second from the first
Xitami
Xitami is offline
#6
Apr7-11, 02:01 AM
P: 129
9*C(9,3)*3!=4536

4536/9=504
digit 1000
0 * 0
1 * 504 = 504
2 * 504 = 1008
...
9 * 504 = 4536
sum = 22680

why 504 & 448? <--- ???
digit 100
0 * 504 = 0
1 * 448 = 448
...
9 * 448 = 4032
sum = 20160

digit 10
...
digit 1
...


20160*3 + 22680 = 83160
FryerMath
FryerMath is offline
#7
Apr7-11, 10:08 AM
P: 5
Sorry, No. There are 4536 numbers with each valuing above 1000. So, the SUM must be at least 4536,000 (BUT it is more!).
Petek
Petek is offline
#8
Apr7-11, 01:39 PM
Petek's Avatar
P: 360
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.
ramsey2879
ramsey2879 is offline
#9
Apr7-11, 08:32 PM
P: 891
Quote Quote by Petek View Post
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 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.
PS I should have edited out the steps to find the sum of all 4 digit numbers as soon as I saw it irrelevant as it was a distraction from my final message.
FryerMath
FryerMath is offline
#10
Apr10-11, 06:09 PM
P: 5
Petek, you were correct! Thank you! I verified the solution with a collegue. I summed the values up to be 24887520
ramsey2879
ramsey2879 is offline
#11
Apr10-11, 06:50 PM
P: 891
Quote Quote by FryerMath View Post
Petek, you were correct! Thank you! I verified the solution with a collegue. I summed the values up to be 24887520
You seem to be off by some 30 + thousand.
Xitami
Xitami is offline
#12
Apr11-11, 03:54 AM
P: 129
+30240
Perfection
Perfection is offline
#13
Apr11-11, 09:21 AM
P: 66
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)!

24,842,250
ramsey2879
ramsey2879 is offline
#14
Apr11-11, 09:41 PM
P: 891
Quote Quote by Perfection View Post
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)!

24,842,250
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.
Perfection
Perfection is offline
#15
Apr11-11, 10:34 PM
P: 66
Yeah, there's double counting here. For instance 0104 would be subtracted from the total erroneously.

Crud!
Petek
Petek is offline
#16
Apr12-11, 12:39 PM
Petek's Avatar
P: 360
Yes, I also got 24,917,760.
ramsey2879
ramsey2879 is offline
#17
Apr12-11, 05:22 PM
P: 891
Quote Quote by Perfection View Post
Yeah, there's double counting here. For instance 0104 would be subtracted from the total erroneously.

Crud!
That is the key, once there is a leading zero, there can be no more zeros. So
the answer is 1111*9*8*7*45 - 111*8*7*45 or 24917760


Register to reply

Related Discussions
Between any two distinct real numbers there is a rational number Calculus & Beyond Homework 3
Distinct number Calculus & Beyond Homework 4
sum of distinct primes Linear & Abstract Algebra 5
Let A be A set of n Distinct Elements. Calculus & Beyond Homework 2
distinct primes Calculus & Beyond Homework 1