# Consecutive Integers Puzzle from JD2178

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 $x + x+1= 1000$. This simplifies to $2x + 1 = 1000$ 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 $4x + 6 = 1000$. 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

$x + x + 1 = 1000$ is $2x + 1 = 1000$
$x + x + 1 + x + 2 = 1000$ is $3x + 1 + 2$ or $3x + 3 = 1000$
and $x + \ldots + x + 3 = 1000$ is $4x + 1 + 2 + 3 = 1000$.

To simplify the second term $1 + 2 + 3$ where $n = 4$ and the total should be 6, I’ll use the formula $(n^2 - n)/2$. So for $n=4$, $(4^2 - 4)/2=6$ it checks out.

Knowing that all the equations have the form $nx + (n^2-n)/2 = 1000$ 2 is useful. Solving for $x$ we get $x =[1000 - (n^2-n)/2]/n$. 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 $[-999+(-999+1999)]/2 \cdot 2000 = 1000$.

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.

1. 499.5 + 500.5 does equal 1000, but 499+500 or 500+501 don’t quite get there
2. Remember, $n$ is the number of consecutive integers and $x$ is the least of them

### 12 Responses to “Consecutive Integers Puzzle from JD2178”

1. Alex October 14, 2009 at 12:59 pm #

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.

2. Alex October 14, 2009 at 1:11 pm #

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.

3. Alex October 14, 2009 at 1:15 pm #

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

4. Jonathan October 17, 2009 at 6:41 pm #

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

5. Nick October 18, 2009 at 11:18 pm #

Hi Jonathon, sorry ’bout that, it’s now fixed.

6. watchmath October 23, 2009 at 4:13 pm #

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).

7. Nick November 1, 2009 at 2:28 pm #

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?

8. Jonathan November 8, 2009 at 6:33 am #

It could be interpreted either way… so let’s choose the way that makes things work nicer?

9. Sean February 29, 2012 at 9:52 pm #

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?

10. Website June 13, 2013 at 10:21 am #

I regard something really interesting about your weblog so I saved to my bookmarks.