text: how can i find all series of consecutive integers whose sum is a given value x?   the sum beginning with 1 and ending with n can be found by solving in n the equation: n(n-1)=2x it is easy to see that if an integer solution n exists it is given by n=int[sqrt(2x)]  ex: sqrt(2*55)=10.488 so, for x=55 take n=10 and verify by the formula n(n+1)/2=x  more generally, if you look for all the series of consecutive integers summing up to x, you want to write x=a+(a+1)+(a+2)+.. (a+n) then look for the sequence:  a(n)= x/n - (n-1)/2 for n=1,2,3... and the greatest n to try is n=[sqrt(2x)].  if a(k) is integer then you have the k-terms sum starting with a(k). this gives an easy program to write down.  example: x=55 55=27+28 55=9+10+11+12+13 (n=5 terms) 55=1+2+..+9+10 (n=10 terms) and  a(2)=x/2-1/2=27 a(5)=x/5-4/2=9 a(10)=x/10-9/2=1