Problems
Consecutive Sums
Consecutive Sums
The sum of p
(p > 0
) consecutive integers can often be equal to the sum of next q consecutive positive integers. For example:
9 + 10 + 11 + 12 = 13 + 14 + 15
, herep = 4
andq = 3
4 + 5 + 6 + 7 + 8 = 9 + 10 + 11
, herep = 5
andq = 3
.
Given the value of q
, how many possible values of p
are there?
Input
Contains at most 1500 lines. Each line contains a positive integer less than 1014
, which denotes the value of q
. Input is terminated by a line containing a single zero. This line should not be processed.
Output
For each input line print one line that contains an integer, which denotes the total number of possible values of p
.
Input example #1
5 1 0
Output example #1
6 2