Question.All the positive numbers can be expressed as a sum of one, two or more consecutive positive integers. For example 9 can be expressed in three such ways, 2+3+4, 4+5 or 9. Given an integer ,you will have to determine in how many ways that number can be expressed as summation of consecutive numbers.
This shows that the no of solutions to this problem is the no of tuples (n,m) such that
given number K can be expressed as K=(1+2+..........+n)-(1+2+3+...........+m)
and n > m
i.e K=n*(n+1)/2 -m*(m+1)/2
If we put the factor n-m=p and (n+m+1)=q,we get S=2*k=p*q
As p+q=2*n+1 is odd and S is even either n-m is odd otherwise n+m+1 is odd.
This leaves out with finding out the no of odd divisors of S,which can be easily done using prime factorization.
then the solution is (q+1)*(r+1)*(s+1)*.. i.e the no of odd divisors of S.
click here for more questions