MathDB
Going Beyond Gauss

Source:

March 15, 2010
Gauss

Problem Statement

When the celebrated German mathematician Karl Gauss (1777-1855) was nine years old, he was asked to add all the integers from 1 through 100. He quickly added 1 and 100, 2 and 99, and so on for 50 pairs of numbers each adding in 101. His answer was 50 · 101=5,050. Now find the sum of all the digits in the integers from 1 through 1,000,000 (i.e. all the digits in those numbers, not the numbers themselves).