A more formal writeup of Riley's method:

Consider an odd divisor o of the target number N. Divide the target number
up in that many pieces (n=N/o). Subtract (n-1)/2 from the first one, (n-1)/2-1
from the second etc (one less for each next number). So for example
 12 = 3*4 = 4+4+4 = 3+4+5
0r:
 14 = 7*2 = 2+2+2+2+2+2+2 = -1+0+1+2+3+4+5

As you can see two things can happen. 

Case one is if the first number is positive. Then you have a sum of 
consecutive positive integers consisting of an odd number of members (o). 

On the other hand, if you have a odd length sequence of positive 
consecutive number adding to the target value, you can average the values
in the symmetric positions (transforming for example 1+2+3 to 2+2+2) which
for going in the other direction (back to 1+2+3) mmust obviously be a case 
one again since it starts with the same positive number you started out with.

Case two is if the first number is negative or zero. There will be more 
positive than neghative values (since the sequence is symmetric around 
a positive value), so you can cancel out the negative numbers against the 
positive ones and drop 0. So in
  14 = -1+0+1+2+3+4+5
cancel -1 versus +1 and drop 0, getting:
  14 =        2+3+4+5
And you end up with an even sized sequence.

On the other hand, if you have a even length sequence of positive 
consecutive number adding to the target value starting with a+1, you can
add -a,-a+1.....a-1,a in front, giving a sequence of odd length. So again 
average out the symmetric positions. This will give a positive average since 
you started out with a sequence of positive values and added as many new 
negative as positive cases.
For example 2+3 becomes -1+0+1+2+3 = 1+1+1+1+1
Going forward from 1+1+1+1+1 to -1+0+1+2+3 again gives you a case two sequence
since they uniquely determine the -1+0+1+2+3 sequence which was actually 
constructed to start with a negative number or 0.

So both cases are completely reversable and it must therefore be a bijection.

Reply via email to