For each number from 1 to 35, how do you find all the ways to write it as a sum of two or more consecutive numbers?

1 Answer

See below for one approach:

Explanation:

I'm going to assume that we are limiting the numbers to integers.

Let's try a few and see if we can spot a pattern:

#1=0+1#
# :.color(red)1 " Way"#

#2=-1+0+1+2#
# :.color(red)1 " Way"#

#3=-2+(-1)+0+1+2+3#
#3=1+2#
#3=0+1+2#
# :.color(red)3 " Ways"#

#4=-3+(-2)+(-1)+0+1+2+3+4#
# :.color(red)1 " Way"#

and so on.

Let's now run through the different ways we can sum numbers:

Only positive integers starting from 0

This gives us:

#1=0+1#
#3=0+1+2#
#6=0+1+2+3#
#10=0+1+2+3+4#
#15=0+1+2+3+4+5#
#21=0+1+2+3+4+5+6#
#28=0+1+2+3+4+5+6+7#

The next number in this series is 36 and so doesn't work.

Only positive integers not starting from 0 (or 1)

First off, we get a doubling of the sums above (since starting from 1 doesn't change the sum itself). But we are now free to start from other positive integers:

#5=2+3#
#9=2+3+4#
#14=2+3+4+5#
#20=2+3+4+5+6#
#27=2+3+4+5+6+7#
#35=2+3+4+5+6+7+8#

#7=3+4#
#12=3+4+5#
#18=3+4+5+6#
#25=3+4+5+6+7#
#33=3+4+5+6+7+8#

#9=4+5#
#15=4+5+6#
#22=4+5+6+7#
#30=4+5+6+7+8#

#11=5+6#
#18=5+6+7#
#26=5+6+7+8#
#35=5+6+7+8+9#

#13=6+7#
#21=6+7+8#
#30=6+7+8+9#

#15=7+8#
#24=7+8+9#
#34=7+8+9+10#

#17=8+9#
#27=8+9+10#

#19=9+10#
#30=9+10+11#

#21=10+11#
#33=10+11+12#

#23=11+12#
#25=12+13#
#27=13+14#
#29=14+15#
#31=15+16#
#33=16+17#
#35=17+18#

Including negative integers

If we include negative integers, like we did in the examples at the start of the answer, we'll first have a way to sum to every integer from 1 to 35.

We can also use smaller summations of negative integers against bigger summations of positive integers starting from 0 to sum to other numbers. This will, in effect, double the list of sums in the "not starting from 0" category (for example, I can sum #-16# through 18 and achieve 35, much like I can get there by simply adding 17 and 18).

In the end:

  • each number can be achieved once by adding negative integers to the sum so that only the single positive integer remains (like we did with this: #4=-3+(-2)+(-1)+0+1+2+3+4# (with the exception being 1 - we can't add a negative to it and have it work)

  • each number in the lists above represents 2 ways it can be achieved.

In the case of starting from 0, we can also start from 1 (the only exception to this being the number 1 - it needs the 0 so that it has something to sum against).

In the case of not starting from 0, we can add negative integers to achieve the same result.

And so, sum total, each number can be achieved this number of ways:

#{:("number", "number of ways"),(1,1),(2,1),(3,3),(4,1),(5,3),(6,3),(7,3),(8,1),(9,5),(10,3),(11,3),(12,1),(13,3),(14,3),(15,7),(16,1),(17,3),(18,5),(19,3),(20,3),(21,5),(22,3),(23,3),(24,3),(25,5),(26,1),(27,7),(28,3),(29,3),(30,7),(31,3),(32,1),(33,7),(34,1),(35,7):}#