# A curious sum for integers $\equiv 7\pmod 8$.

For $n$ a natural integer congruent to $7$ modulo $8$, one has seemingly always $$\sum_{k=1}^{(n-1)/2}\left(\frac{k}{n}\right)k=0$$ where $\left(\frac{k}{n}\right)$ denotes the Jacobi symbol.

First cases:

$n=7$: $1+2-3$

$n=15$: $1+2+4-7$

$n=23$: $1+2+3+4-5+6-7+8+9-10-11$

I do not see any reason for this. Did I miss something obvious?

• See math.stackexchange.com/questions/114293/ Feb 1, 2013 at 14:50

There are probably lots of ways to see this, but here's one: let $S_1$ be the sum above, and let $$S_2 = \sum_{k=(n+1)/2}^{n-1} k \left( \frac{k}{n} \right).$$ Then $$S_1 + S_2 = S = \sum_{k=1}^{n-1} k \left( \frac{k}{n} \right).$$ Now you can rewrite $S$ (since $x \to 2x$ is a bijection mod $n$) as $$S = \sum_{k=1}^{(n-1)/2} 2k \left( \frac{2k}{n} \right) + \sum_{k=(n+1)/2}^{n-1} (2k-n) \left( \frac{2k}{n} \right) = 2S - n \sum_{k=(n+1)/2}^{n-1} \left( \frac{k}{n} \right),$$ where we used $(2/n) = 1$. Finally, we have $$S = 2S + n \sum_{k=1}^{(n-1)/2} \left( \frac{k}{n} \right),$$ by changing $k$ to $n-k$ in the summation and using $(-1/n) = -1$. So $S = -n\sum_{k=1}^{(n-1)/2} \left( \frac{k}{n} \right)$.
On the other hand, we can switch the index in $S_2$ from $k$ to $n-k$ as well, to get $$S_2 = \sum_{k=1}^{(n-1)/2} (n-k) \left( \frac{n-k}{n}\right) = -n \sum_{k=1}^{(n-1)/2} \left( \frac{k}{n} \right) + \sum_{k=1}^{(n-1)/2} k \left( \frac{k}{n} \right) = S + S_1 = 2S_1 + S_2.$$ (We used $(-1/n) = -1$ again).
Therefore $S_1 = 0.$