If you’re a programmer, you may spend a lot of time figuring out how to make things faster. If you work with number-crunching, you’ve seen plenty of cases where you can greatly reduce a program’s runtime by some huge factor. You’re probably pretty good at it…

If you’d like to test your algorithmic wit, describe how to speed these calculations up (Ie., without actually adding up all the numbers):

What is the sum of the whole numbers between 1 and a trillion (10^12)?

What is the sum of the whole numbers between 1 and a trillion that have the additional property that they are divisible by 7? (7, 14, 21, …)

What is the sum of the whole numbers between 1 and a trillion that are divisible by 7 and when reversed are still divisible by 7? Numbers like 7, 168, and 1169 do this.