English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

What is the sum of all of the digits of all the whole numbers from 1 to 1,000,000 (inclusive?
Thanks for any answers in advance. :)

2007-11-22 05:47:14 · 11 answers · asked by cf_al_bs 2 in Science & Mathematics Mathematics

Just to clarify: Not the sum of all the numbers. The sum of all the digits of all the whole numbers.

2007-11-22 06:11:45 · update #1

11 answers

I am not a patient enough mathematician to come up with a formula to add up all the digits but I can come up with an algorithm that does it. The algorithm is based on the following example:

consider a 4 digit number 'n' composed of digits xyzu, we have:

n = x*1000 + y*100 + z*10 - u

We want some way of teasing out x,y,z and u. Now:

x = [n/1000]
y = [(n - x*1000)/100] = [n/100] - x*10
z = [(n - x*1000 - y*100)/10]
u = n - x1000 - y100 - z*10

where [x] = floor(x)

Closer examination allows us to simplify the above to:

x = [n/1000]
y = [n/100] - 10*[n/1000]
z = [n/10] - 10*[n/100]
u = n - 10*[n/10]

We can generalise this for any digit of any number, n, say x_k where x_k is the kth digit of n:

x_k = [n/10^(k-1)] - 10 * [n/10^k]


we can now write an algorithm to solve for the above. I generally use the matlab program to do my stuff. In matlab this is only a few lines:

n = 1:1e6;
v = floor(n' * (1./(10.^[7:-1:0])));
sum(sum(v(:,2:end) - 10*v(:,1:end-1)))

and the answer is:

27,000,001

amazingly enough the first post was dead on. I wonder what technique she used?

The best way about doing it like this is that I can do a lot more with it. For example I can sum up the digits of all the numbers between 289347 and 304958 inclusive. The algorithm above gives an answer in a split second: 403827

Neat.

2007-11-22 06:46:03 · answer #1 · answered by perplexed* 3 · 0 2

Okay, from 000,000 to 999,999, each digit 0-9 appears exactly 1/10th of the time in each position. That is another way of saying that the sum 0+..+9 = 45 happens 100,000 times in each position, for a total of 45 x 100,000 x 6 = 27,000,000. And then we've got 1,000,000, making for a grand total of 27,000,001.

I've noticed that the other answers are summing the numbers, not the digits? Is manjyomesando1 the only other one reading this problem in the same way I am?

Hey, I like those answerers that say that only supercomputers can do this, or maybe even mankind will never find out.

2007-11-22 06:04:38 · answer #2 · answered by Scythian1950 7 · 6 0

What is the sum of the digits needed to write all the whole numbers from 0 to 10,000, inclusive?

It is actually not as hard as you think...


First, you start to list...(DO NOT actually list every #)

000000
000001
000002
...........
999999

In all, there are 6,000,000 #s (6 columns and 1,000,000 rows) right over here...There is actually a pattern listed...The ones place starts like this...0,1,2,3,4,5,6,7,8,9...and the pattern goes on...and continues in the hundreds place, the thousands place...

The sum of 0,1,2,3,4,5,6,7,8,9...is 45...so there are 1/10 of 1,000,000*6(remember there are 6 columns and 1,000,000 rows) patterns of 45 in all.

The answer is 45*1/10*1,000,000*6 which gives us the total of 27,000,000...do not forget that you also have the last #...1,000,000, so you have to add 1 to the answer.

Therefore, the final answer is 27,000,001.

Hooray!!!

2013-11-10 03:58:54 · answer #3 · answered by Cameron 1 · 0 0

All The Whole Numbers

2016-12-11 19:03:38 · answer #4 · answered by ? 4 · 0 0

27000001

answer
= 6*45*10^5 + 1
= 270*10^5 + 1
= 2.7*10^7 + 1
= 27000001

2007-11-22 05:50:56 · answer #5 · answered by Mugen is Strong 7 · 3 2

sum of n digits ( 1 to n) is given by

S(n) = n(n + 1)/2

here n = 1,000,000

S(1,000,000) = 1,000,000(1,000,001)/2

=>500000(1,000,001) = 5000005*(10^5)

2007-11-22 05:58:58 · answer #6 · answered by mohanrao d 7 · 2 1

= (1,000,000 * (1,000,000 + 1 ) ) / 2

= (1,000,000 * 1,000,001) / 2

= 1,000,001,000,000 / 2

= 500,000,500,000

2007-11-22 06:04:59 · answer #7 · answered by Horatio 7 · 1 1

I like the answer stating that not even computers can solve this problem, even though you can solve it using your brain in like 30 seconds.

It's 1000001*500000 = 500.000.500.000

2007-11-22 05:54:38 · answer #8 · answered by SonniS 4 · 2 3

There might be a supercomputer that could solve this but it would take ages. I also wonder if it would overflow as you are talking a truly huge number.

2007-11-22 06:00:20 · answer #9 · answered by Anonymous · 0 5

dude that would take days to solve thats nearly impossible to calculate without advanced equipment i have no idea and neither will anyone else

2007-11-22 05:51:38 · answer #10 · answered by Anonymous · 0 5

fedest.com, questions and answers