Asked by Jane
Is there a formula to sum the digits between two numbers?
eg. 1 to 20 = 1+2+3+4+5+6+7+8+9+1+0+1+1+1+2+1+3+1+4+1+5+1+6+1+7+1+8+1+9+2+0 = ??
I am looking for the numbers 1 to 2008 so I really need a formula!
Please help, thank you.
Jane
eg. 1 to 20 = 1+2+3+4+5+6+7+8+9+1+0+1+1+1+2+1+3+1+4+1+5+1+6+1+7+1+8+1+9+2+0 = ??
I am looking for the numbers 1 to 2008 so I really need a formula!
Please help, thank you.
Jane
Answers
Answered by
drwls
There must be such a formula, but it will depend upon how many digits are in the number, and what the initial digits are.
From n = 0 to 9, if n is the largest number, the sum of digits is
n(n+1)/2
From n = 10 to 19, in n is the largest number and you include the sum for digits for 1 though 9, the sum is
45 + (n-9) + (n-10)(n-9)/2
For n = 20 to 29, the sum is
55 + 2(n-19) + (n-20)(n-19)/2
And it keeps getting messier.
From n = 0 to 9, if n is the largest number, the sum of digits is
n(n+1)/2
From n = 10 to 19, in n is the largest number and you include the sum for digits for 1 though 9, the sum is
45 + (n-9) + (n-10)(n-9)/2
For n = 20 to 29, the sum is
55 + 2(n-19) + (n-20)(n-19)/2
And it keeps getting messier.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.