http://www.spoj.com/problems/CPCRC1C/

http://math.stackexchange.com/questions/817038/sum-of-digits-of-number-from-1-to-n