Can anyone tell me how to approach this question ? I have been trying it for quite sometime now, but to no avail.. The link to the question is : http://www.spoj.com/problems/EASYFACT/
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
Can anyone tell me how to approach this question ? I have been trying it for quite sometime now, but to no avail.. The link to the question is : http://www.spoj.com/problems/EASYFACT/
Name |
---|
Any sum of consecutive integers can be described by a low value a and a length r. So we must have:
Try simplifying this expression and then factoring it.
Can you please explain this one a bit more ? I had got this expression, but unable to proceed any further..
Sure. To get that first formula, notice that
Simplifying the formula in my previous comment, we get
Instead of counting all pairs (r,a) we will count all pairs (r,r+2a+1) because it's simpler: now we're just counting all ordered pairs (x,y) with xy = 2N! where x<y and x and y have different parity.
This is equivalent to counting the number of odd divisors of 2N!. I can explain the solution to this reduced problem if you're still stuck.
Suppose that I consider n = 5. Now if I am counting the number of odd divisors of (2 * 5 !), then I am getting the odd divisors as (1, 3, 5, 15), which is 4. But in the question, we can see that the answer for n = 5 is 2, i.e., when we are considering the sum of 3 consecutive positive integers(39 + 40 + 41) and the sum of 5 consecutive positive integers(22 + 23 + 24 + 25 + 26). So still stuck..
Since we have to remove the case when r=1, we must subtract 1 from the final answer (so for n=5, we get 3). The answer for n=5 should be 3, since we also have the sum of 15 consecutive positive integers (120 = 1 + 2 + ... + 14 + 15).
.
This may be sound silly but how did you concluded that "This is equivalent to counting odd divisors of 2N!"