Given a number N, find the number of ways to represent this number as a sum of 2 or more consecutive natural numbers.
n+1 consecutive number can be summed up to get sum N
sum = f + (f+1) + (f+2) + .. + (f+n);
sum = (n+1)/2 * (f + f + n); // using A.P. formula.
sum = (n+1)/2 * (2 * f + n);
f = sum/(n+1) – n/2;
We substitute the values of n starting from 1 till n*(n+1)/2 < sum
If we get ‘f’ as a natural number then the solution should be counted.