This is a perfect extension for some of the problems I’m giving a test over tomorrow, so it caught my eye.
How many ways can 1000 be expressed as the sum of consecutive integers?
My first instinct was to start writing equations to find the sum of a set of consecutive integers with x as the least. I began with
. This simplifies to
but the solution is not an integer so there are not two consecutive integers that add to 10001.
To test four integers we’d use the equation
. And suddenly infinity starts to dawn on us as we realize there could be a lot checking to be done. So back to equations and formulas. I looked at a set of simplified equations
is 
is
or 
and
is
.
To simplify the second term
where
and the total should be 6, I’ll use the formula
. So for
,
it checks out.
Knowing that all the equations have the form
2 is useful. Solving for
we get
. We can now test (n) different consecutive integers to find the starting integer (x). In cases where both x and n are integral we have a solution, count the solutions and the problem is solved.
To count the solutions I wrote up a spreadsheet with three columns, a column for values of n, values of (1000 – (n^2-n)/(2))/n, and a simple column that would take the value of the second column formatted with
if(mod(value,1)=0,”solution”,”")
which holds “solution” only when the value of 1000-(x… is an integer.
I found 6 solutions: 5 consecutive integers (starting with 198: 198, 199, 200, 201, 202), 16 (starting with 55), 25 (starting with 28), 80 (starting with -27), 125 (starting with -54) , and 400 (starting with -197). After checking to see if there are more, I find a 7th solution with 2000 consecutive integers starting with -999 – it checks out
.
So I guess I’m starting to wonder whether you couldn’t find an infinite number of solutions. Here’s a similar spreadsheet I cooked up on Google Spreadsheet. On excel I’ve checked up to about 13,000 consecutives and still not found any other solutions…
I also thought I noticed a pattern in the solutions that they were expanding by multiples of 5 so first there were 5 then 16 (doesn’t fit) then 80, then 400, then 2000… so I checked 10,000 consecutives, and found that there is not an integral starting point. So much for the pattern of fives.
My final answer is 7 sets of consecutive integers add up to 1000. And I wonder if there’s an easier way.
Here’s my attempt at a different solution. The first part came very naturally:
First, note that 5+6+7+8+9 = 7*5. Why does this matter? Well, in general the sum of (2k+1) consecutive integers will always be a multiple of (2k+1). Indeed, there will be at ONE SUCH SUM for EVERY ODD FACTOR of our target number.
So, what are the odd factors of 1000? Looking at its prime factorisation, 2cubed * 5cubed, we see quickly that they are 1, 5, 25 and 125.
Thus all the sums of odd length are
1: 1000
5: 198+199+200+201+202
25: …..+40+…..
125: …..+8+….. – note that a lot of these integers are negative.
So much for sums of an odd number of integers. Sums of an even number of integers are a little more complicated, though.
Before, we said 5+6+7+8+9 = 7*5, so 5 divides the answer.
Now, we have 5+6+7+8 = 6.5*4 = 26. We clearly can’t conclude that 4 divides 26 – but is true that 4/2 has to divide 26.
Why is that so? Well,
(sum of an even number of integers) = midpoint * length = 2*midpoint * length/2 = sum.
Thus half the length (remember the length is even here) divides the sum. But there’s more: crucially, the midpoint can’t be a whole number, so 2*midpoint MUST BE ODD. Once again we have a 1:1 correspondence between odd factors, and sequences.
Again, the odd factors of 1000 are 1, 5, 25 and 125. These correspond to lengths of
(1000/1)*2 = 2000, giving a sequence …..+0+1+…..
(1000/5)*2 = 400, giving a sequence …..+2+3+…..
(1000/25)*2 = 80, giving a sequence …..+12+13+…..
(1000/125)*2 = 16, giving a sequence …..+62+63+…..
So in total, there eight sequence of integers summing to 1000 (though I did count “1000″ as an answer, you might not).
More generally, though, for any number, there will be twice as many of these sequences as the number has odd factors.
So for example, 1,000,000 = 2^6 * 5^6 has seven odd factors, so it can be expressed as a sum of consecutive integers in 14 different ways.
One final note (sorry to take up 3 posts! Feel free to smoosh them together if that’s possible) – I probably won’t look back here, so if you find mistakes or have a question, I’m on gmail as alexrdavies1
Hi,
that’s jd2718 (as in e), not 217.
I posted an alternate solution. And then I posted a tougher follow-up question that you might enjoy!
Jonathan
Hi Jonathon, sorry ’bout that, it’s now fixed.
I can prove that there are 8 solutions. I believe you missed the sequence that consist of single number which is 1000 itself. Let me know if you want to see the prove (the prove is simple).
I was a little confused as to whether or not 1000 by itself could constitute a “sum of consecutive integers” in the phrasing of the problem, thoughts?
It could be interpreted either way… so let’s choose the way that makes things work nicer?
At first, when I began this problem on my math test, I did the same thing Alex did in his first post, but when I checked for under-counting, I found out that 16 was also included as a solution (the test asked for positive consecutive integers). Can someone explain why 16 is an answer?
I regard something really interesting about your weblog so I saved to my bookmarks.