The question is $$\text{If }\, p, \ q\in \mathbb{N}, \;1-\frac12+\frac13-\frac14-\dotsb-\frac{1}{1318}+\frac{1}{1319}=\frac{p}{q}.\qquad \text{Prove that } 1979\mid p.$$

So my solution went like this:

$$S=1-\frac12+\frac13-\frac14-\dotsb-\frac{1}{1318}+\frac{1}{1319}\Rightarrow S=\sum_{k=1}^{1319}\frac{1}{k}-2\sum_{k=1}^{659}\frac{1}{2k}=\sum_{k=660}^{1319}\frac{1}{k}$$ Now this is equivalent to finding the sum of the roots of the equation $$\left(x-\frac{1}{660}\right)\left(x-\frac{1}{661}\right)\dots \left(x-\frac{1}{1319}\right)=0$$.

Rewriting this equation, we get $(660x-1)(661x-1)\dotsc(1319x-1)=0$ (we can discard the $\displaystyle \frac{1319!}{659!}$ since $1979$ is a prime). Calculating the sum of the roots, we get the required value to be equal to $(1320+659)\times 330$ which is obviously divisible by $1979$ (again discarding the coeffecient of $x^{660}$).

Now my question is: Using the same method of converting the problem into finding the sum of roots of a polynomial, we get from the original equation something like this: $$(x-1)\left(x+\frac{1}{2}\right)\dots \left(x-\frac{1}{1319}\right)=0 \Rightarrow (x-1)(2x+1)\dotsc(1319x-1)=0$$

So, the sum of roots would be $-1+2-3+4-\dotsc+1318-1319=-660$ But this is not divisible by $1979$. Why does the former solution work while the latter doesn't? Is there a flaw in my reasoning?

Note: I know that the question can be solved by some other methods. Please only explain my given doubts and don't instead give another solution


I realised my mistake after some hours of pondering over it.

(In the 1st equation) To get the required sum I would need to take calculate $\displaystyle -\frac{\text{coeffecient of }x^{659}\,}{\text{coeffecient of }x^{660}}$. However what I've done is calculate this: $\displaystyle -\frac{\text{ coeffecient of }x}{\text{coeffecient of }x^{660}}$ which is actually equal to $\text{sum of roots taken }659 \text{ at a time} $. It was just a coincidence that the value I calculated was divisible by $1979$.

The correct way, indeed, would be through the link supplied above


Here is the solution in the comments, typed out as an answer.

The trick is to separate out the negative terms:

$$1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \cdots - \frac{1}{1318} + \frac{1}{1319}$$ $$= 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{1319} - 2 \left( \frac{1}{2} + \frac{1}{4} + \cdots + \frac{1}{1318} \right)$$ $$=\frac{1}{660} + \frac{1}{661} + \cdots + \frac{1}{1319}.$$

and to notice that $660 + 1319 = 1979$. Combine terms in pairs from the outside:

$$\frac{1}{660} + \frac{1}{1319} = \frac{1979}{660 \cdot 1319}$$ $$\frac{1}{661} + \frac{1}{1318} = \frac{1979}{661 \cdot 1318}$$ $$\cdots =\cdots$$

and so on.

There are an even number of terms, so this gives us a sum of terms in the form $\frac{1979}{m}$, with m not divisible by $1979$ (since $1979$ is prime and so does not divide any product of smaller numbers).

Hence the sum of the terms gives a rational number with denominator not divisible by $1979$. Q.E.D