The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Sums of Consecutive Integers

Date: 08/18/99 at 23:12:54
From: Eric
Subject: Adding consecutive numbers

Is there a way of finding a series of consecutive integers whose sum 
is a given number?

For example:

     3 = 1 + 2

     (There is no series that produces a sum of 4)

     5 = 2 + 3

     6 = 1 + 2 + 3

     7 = 3 + 4

     (Is there one that produces a sum of 8?)

     9 = 2 + 3 + 4,   and   9 = 4 + 5

     and so on...


Date: 08/19/99 at 16:56:07
From: Doctor Rick
Subject: Re: Adding consecutive numbers

Hi, Eric. You've asked an interesting question.

Are you investigating this on your own, or is it a school project? You 
have discovered the beginning of a pattern. To learn more than this, 
though, takes algebra.

It took a little work, but I believe I have proved that this can be 
done for any number that has an odd factor (other than 1). In other 
words, if there is an odd number other than 1 that divides evenly into 
the number, then there is a list of consecutive numbers that add to 
the number.

The number 4 has no odd factors, since 4 = 2 x 2. The same is true for 
8, since 8 = 2 x 2 x 2. Numbers like this (called powers of 2) are the 
only numbers that will not work; all others will. The next number that 
won't work is 16.

Here is a method for finding the series of consecutive numbers that 
add to a particular number. I'll demonstrate it with the number 52. 
Find an odd factor: 52 is divisible by 13. Double the original number 
and divide it by the factor you chose:

     2 * 52 / 13 = 8

Subtract 8 from 13 (the smaller number from the bigger number) to get 
5; add 1 and divide by 2 to get 3. Start with 3 and write 8 numbers 
(the smaller of the 2 factors), and this series will add to 52.

     3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 52

Sometimes, as you found, there is more than one solution. Any number 
that has more than one odd prime factor will have more than one 
solution. For a sum of 9, we look for odd factors, and we find 3 and 
9. I'll start with 3. 3 goes into 18 6 times; subtract 3 from 6, add 
1, and divide by 2 to get 2. Write 3 numbers starting with 2:

     2 + 3 + 4 = 9

Using the other odd factor, 9, we divide 18 by 9 to get 2. Subtract 2 
from 9, add 1 and divide by 2 to get 4. Write 2 numbers starting with 

     4 + 5 = 9

just as you found.

The way I've described it, this is just magic. But believe me, I found 
the formula using math. If you want to learn more about how I did it, 
write back. I'd be glad to explore it with you. In the meantime, you 
have a nice little trick to show people.

- Doctor Rick, The Math Forum   

Date: 01/27/2002 at 19:24:34
From: R. Lineage
Subject: Summing Consecutive Numbers


Has anyone written back? I played around with it a bit, and noticed that 
if the number is twice a prime (e.g. 46), then you have to use Dr. Rick's 
method. But if it's not twice a prime, i.e. 294, then there's a slightly 
easier way.

Find any odd prime factor (the smaller the better) and divide this 
into the number. [3 is an odd prime factor of 294, and 294/3 = 98.]
The factor (3) is the number of terms needed. The answer (98) is the 
middle number. So, in this case, 294 = 97+98+99

You could do it with the factor of 7 as well. In this case, 
294/7 = 42, so there would be 7 terms, with the middle term being 42.

294 = 39+40+41+42+43+44+45

This is a bit easier than Dr Rick's method. But I still would like to 
know how he came up with his method.


Date: 01/28/2002 at 14:24:51
From: Doctor Rick
Subject: Re: Summing Consecutive Numbers

Hi, R.

Unfortunately, Eric did not write back, and it's been almost 2 1/2 years 
since I worked out the formula, so I don't recall exactly what I did! I'll 
try to reconstruct my work.

If we have a sequence of k consecutive integers starting with n, then 
their sum is

  n + (n+1) + (n+2) + ... + (n+k-1)

  = kn + k(k-1)/2

  = k(n+(k-1)/2)

  = k(2n+k-1)/2

Here I have used the formula for the sum of (k-1) consecutive integers 
beginning with 1. The sum must be the number we are seeking to write as 
a sum of consecutive integers; I'll call it S.

  S = k(k+2n-1)/2

In order for S to be an integer, one of the two factors k and (k+2n-1) 
must be even. In fact, since their difference (2n-1) is odd, exactly one 
of these numbers is even, and the other is odd.

In either case, we can solve for n in terms of k:

  k+2n-1 = 2S/k

  n = (2S/k - k + 1)/2

If k is an odd factor of S, then (k+1)/2 is an integer, and 
(2S/k)/2 = S/k is an integer, therefore n is an integer.

If k is even, then (k+2n-1) is an odd factor of S. Call this factor f, and 
we find

  S = kf/2
  k = 2S/f

  n = (2S/k - k + 1)/2
    = (f - 2S/f + 1)/2

Thus we have two solutions for each odd factor of S:

  n = (2S/f - f + 1)/2, k = f
  n = (f - 2S/f + 1)/2, k = 2S/f

These solutions are related: for example, for S = 68 = 2*2*17, the 
solutions are (with f = 17, the only odd factor)

  n = (2*68/17-17+1)/2 = -4, k = 17
  -4+-3+-2+-1+0+1+2+3+4+5+6+7+8+9+10+11+12 = 68

  n = (17-2*68/17+1)/2 = 5,  k = 2*68/17 = 8
  5+6+7+8+9+10+11+12 = 68

If n < 0 and k > 2n+1, then the first 2n+1 terms total zero and can be 
eliminated, leaving the other solution.

This was the solution I gave in words:

Double the original number [S] and divide it by the odd factor you chose 
[K, obtaining 2S/K]. Subtract the smaller factor [k] from the greater 
factor; add 1 and divide by 2. Start with this number [n] and write 
[k] numbers, and this series will add to [S].

This solution ensures that we get the solution with positive n. 

Now let's consider your simplification. If the number S is not twice a 
prime, then your formula is to pick a (small) odd prime factor of S, 
use this as k (the number of consecutive numbers) and use 2S/k as the 
middle term. 

The middle term (if k is odd, so there is a middle term) is n+(k+1)/2. 
My first formula for n makes the middle term

  n+(k-1)/2 = (2S/k-k+1)/2 + (k+1)/2
            = S/k

The only difference between our formulas, therefore, is that you only 
get one of the two solutions; in some cases it is the solution with 
negative starting number. For instance, for S = 2*17 = 34, you get 
17 terms with the middle number 2, or

  -6+-5+-4+-3+-2+-1+0+1+2+3+4+5+6+7+8+9+10 = 34

which is a valid solution, but it can be reduced to

  7+8+9+10 = 34

Let's combine our two solutions:

To find a sequence of consecutive integers that add to a given positive 
integer S, choose any odd factor of S, and call this factor f. (If S is 
a power of 2 and thus has no odd factor, there is no solution.) Write 
down f consecutive integers with S/f as the center number (thus, the 
first number is S/f-(f-1)/2, and the last number is S/f+(f-1)/2). This 
sequence adds to S. If the first number is less than zero, drop the first 
numbers through the negative of the first number; the sum will be the same.

- Doctor Rick, The Math Forum   

Date: 01/28/2002 at 17:11:51
From: R. Lineage
Subject: Summing Consecutive Numbers

Thanks, Dr Rick, for your very quick reply. I find it intriguing how 
mathematicians come up with stuff. I am just beginning maths teaching 
in Australia. I love maths, but I don't think I'm what they'd call a 
natural. But I get a major kick with number theory. E.g. when I found 
out about wondrous numbers, and the challenge to see if 27 was a 
wondrous number, I couldn't help myself. I set up an Excel 
spreadsheet to do a calculation for all numbers from 1 to 1000, and 
all of them eventually went to 1. The formulae were actually pretty 
simple, but it was only then that I was happy!

Anyway, I think the whole Dr Math site is absolutely fantastic. I'm 
not interested in teaching maths if I can't explain things clearly to 
my students, and the site is helping me lots.

Thanks again...
Associated Topics:
Middle School Number Sense/About Numbers

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.