One two, uno dos tres quatro

They say that when Carl Friedrich Gauss was eight, he discovered a secret for quickly adding all the numbers from 1 to 100.

Now, I’m going to teach you a trick I discovered, for adding up all the numbers from 1 to a number, where said number starts with 1, followed by one or more zeros.

So, for example, this cute trick only works for 10, or 1000, or 1000000000000, but not 13040.

Here’s how to do it.

  1. Start with the number that you want to add up to. We’ll call it N.
  2. Count the number of trailing zeros in it.
  3. Subtract one from that number.
  4. Let’s call that result K.
  5. Now, to start writing the answer, write down a 5.
  6. Write K zeros after it.
  7. Now, write down a 5.
  8. Now, write K zeros after it.
  9. You’re done!

Let’s do an example with 10000.

  1. Start with the number that you want to add up to. We’ll call it N. (N is 10000)
  2. Count the number of trailing zeros in it. (4)
  3. Subtract one from that number. (3)
  4. Let’s call that result K. (K = 3)
  5. Now, to start writing the answer, write down a 5. (5)
  6. Write K zeros after it. (5000)
  7. Now, write down a 5. (50005)
  8. Now, write K zeros after it. (50005000)
  9. You’re done! (Adding all the numbers from 1 to 10000 gives you 50005000.)

$$
\begin{aligned}
j \in \mathbb{N}: \sum_{n=1}^{10^{j}}n &= \frac{10^{j}(10^{j}+1)}{2} \\
&= \frac{10^{2j}+10^{j}}{2} \\[10pt]
&= 5 \times 10^{2j-1}+5 \times 10^{j-1} \\
\end{aligned}
$$