## Enormous Sum

Compute the sum of the sum of all 8-digit numbers and the sum of all 10-digit numbers.
Source: mathcontest.olemiss.edu 11/3/2008

SOLUTION

We need to recall the formula used to calculate the sum of an arbitrary sequence of counting numbers. Given a sequence of counting numbers $a_1,a_2,a_3,\cdots,a_n$ arranged in increasing order starting from the smallest number $a_1$ to the largest number $a_n$:

$a_1+a_2+a_3+\cdots+a_n=\frac{\left (a_n+a_1\right )\left (a_n-a_1+1\right )}{2}$

You may have seen this formula when the sequence is $1,2,3,\cdots,n$:

$1+2+3+\cdots+n=\frac{\left (n+1\right )n}{2}$

STEP 1 Calculate the sum $S_8$ of all 8-digit numbers.

We will calculate by hand because we want exact values and not rounded up approximation given by the calculator. Remember we do not count leading zeros as part of the numbers, i.e. $00000001$ is not considered an 8-digit number.

The smallest 8-digit number is $a_1=10,000,000=10^7$.

The largest 8-digit number is $a_n=99,999,999$.

Applying the above formula:

$S_8=\frac{\left (99,999,999+10,000,000\right )\left (99,999,999-10,000,000+1\right )}{2}$

$=\frac{\left (109,999,999\right )\left (10^8-10^7\right )}{2}$

Factoring out $10^7$:

$=\frac{\left (109,999,999\right )\left (10^7\right )\left (10-1\right )}{2}$

$=\frac{\left (109,999,999\right )\left (10^7\right )\left (9\right )}{2}$

$=109,999,999\times45\times10^6$

Let’s calculate the product $109,999,999\times45$ using pencil and paper as follows:

$109,999,999\times45=109,999,999\left (5+40\right )$

$=549,999,995+4,399,999,960$

$=4,949,999,955$

Thus, $S_8=4,949,999,955\times10^6$.

STEP 2 Calculate the sum $S_{10}$ of all 10-digit numbers.
The smallest 10-digit number is $a_1=10^9$.

The largest 10-digit number is $a_n=9,999,999,999$.

$S_{10}=\frac{\left (9,999,999,999+10^9\right )\left (9,999,999,999-10^9+1\right )}{2}$

$=\frac{\left (10,999,999,999\right )\left (10^{10}-10^9\right )}{2}$

Factoring out $10^9$:

$=\frac{\left (10,999,999,999\right )\left (10^9\right )\left (10-1\right )}{2}$

$=\frac{\left (10,999,999,999\right )\left (10^9\right )\left (9\right )}{2}$

$=10,999,999,999\times45\times10^8$

Let’s calculate the product $10,999,999,999\times45$ using pencil and paper as follows:

$10,999,999,999\times45=10,999,999,999\left (5+40\right )$

$=54,999,999,995+439,999,999,960$

$=494,999,999,955$

Thus, $S_{10}=494,999,999,955\times10^8$.

Finally, we calculate the enormous sum of $S_8+S_{10}$:

 4,949,999,955,000,000 49,499,999,995,500,000,000 49,504,949,995,455,000,000