I was looking at sequence A063865 of the OEIS, which is given by the number of ways of choosing $+$ and $-$ signs such that $\pm1 \pm 2 \pm 3\dots \pm n =0$. If we define the $n$-th element of this sequence by $S(n)$, then, for example, $S(3)=\color{blue}{2}$ since \begin{align} +1+2+3 &= 6\\ -1+2+3 &= 4\\ +1-2+3 &= 2\\ \color{blue}{-1-2+3} &\mathbin{\color{blue}{ =}} \color{blue}{0}\\ \color{blue}{+1+2-3} &\mathbin{\color{blue}{ =}} \color{blue}{0}\\ -1+2-3 &= -2\\ +1-2-3 &= -4\\ -1-2-3 &= -6 \end{align} has two cases where the sum equals $0$.
In the formula section of this sequence on its OEIS page the following is stated:
$S(n) = 0$ unless $n \equiv 0, 3 \ \, (\bmod 4\,)$
This formula intrigued me as it wasn't apparent to me why this must be true. After looking at the links on the OEIS page, I found that this paper by Andrica and Tomescu was referenced repeatedly. In said paper, the authors give the following argument:
"Since $M = \{1, 2, . . . , n\}$ has sum $T_n = \frac{n(n + 1)}{2}$ and every class of an ordered bipartition of $M$ must have sum $\frac{T_n}{2}$, it follows that $S(n) = 0$ for $n \equiv 1$ or $2 \ \, (\bmod 4\,)$ and $S(n)\neq 0$ for $n \equiv 0$ or $3 \ \, (\bmod 4\,)$"
And although concise, after reading this argument I wondered if there was a way to prove said statement using some more elementary methods. So this is what I attempted to do.
In Andrica and Tomescu's paper I reference above, they give the following representation for the sequence: $$ S(n) =\frac{2^{n-1}}{\pi}\int_0^{2\pi} \prod_{k=1}^{n} \cos(kx)\, \mathrm{d}x $$ The way to see that this integral representation equals the sequence is achieved by writing the cosines in their complex representation as follows: $$ \frac{2^{n-1}}{\pi}\int_0^{2\pi} \prod_{k=1}^{n} \cos(kx)\, \mathrm{d}x =\frac{2^{n-1}}{\pi}\int_0^{2\pi} \prod_{k=1}^{n} \frac{e^{ikx} + e^{-ikx}}{2}\, \mathrm{d}x = \frac{1}{2\pi}\int_0^{2\pi} \prod_{k=1}^{n}e^{ikx} + e^{-ikx}\, \mathrm{d}x $$ And since $e^{\pm ikx} =0$ for all integers $k \neq 0$ then the only part contributing to the integral is the constant term in $ \prod_{k=1}^{n}e^{ikx} + e^{-ikx}$. But since the constant term is just the number of times the exponents $\pm1 \pm 2 \pm 3\dots \pm n$ add to $0$, then the constant term is exactly $S(n)$, thus completing the proof of the assertion.
Having established this representation, here's how I used it in my attempt.
My proof
Suppose $n= 4m +2$ and for some $m \in \mathbb{Z}$. Then \begin{align} S(4m+2) &=\frac{2^{n-1}}{\pi}\int_0^{2\pi} \prod_{k=1}^{4m+2} \cos(kx)\, \mathrm{d}x \\& \overset{x \to \pi-x}{=} \frac{2^{n-1}}{\pi} \int_{-\pi}^{\pi}\prod_{k=1}^{4m+2}\underbrace{\cos(k\pi)}_{(-1)^{k}}\cos(kx)\, \mathrm{d}x \\& =\frac{2^{n}}{\pi}\underbrace{(-1)^{ 2\left(4 m^2 + 5m\right)+3}}_{\frac{(4m+2)(4m+3)}{2}=2\left(4 m^2 + 5m\right)+3} \int_{0}^{\pi}\prod_{k=1}^{4m+2}\cos(kx)\, \mathrm{d}x \end{align} But now we see that \begin{align} S(4m+2) =- \frac{2^n}{\pi}\int_{0}^{\pi}\prod_{k=1}^{4m+2}\cos(kx)\, \mathrm{d}x & \overset{x\to \pi-x}{=}- \frac{2^n}{\pi}\underbrace{(-1)}_{(-1)^{ 2\left(4 m^2 + 5m\right)+3}} \int_{0}^{\pi} \prod_{k=1}^{4m+2}\cos(kx)\, \mathrm{d}x = - S(4m+2) \end{align} So we can conclude that $S(n) = 0$ for $n \equiv 2\ \, (\bmod 4\,)$.
The case for $n \equiv 1 \ \, (\bmod 4\,)$ is analogous, since $\frac{(4m+1)(4m+2)}{2} = 2(4m^2+3m)+1$ this implies that $(-1)^\frac{(4m+1)(4m+2)}{2} = -1$, and the rest follows.
I'm pretty happy with my proof, mostly because I find it curious that deals with discreet maths about counting numbers of combinations can be tackled with a calculus argument which is usually what you use for problems involving continuous functions.
Despite this, I'm not entirely convinced that I achieved my goal of obtaining an elementary proof since an argument can be made that complex representations of trig functions and calculus arguments are not so basic after all. So my question is
What are some elementary ways to show that there's no solution to $\pm1 \pm 2 \pm 3\dots \pm n =0$ for $n \equiv 1,2 \ \, (\bmod 4\,)$?
If $n \pmod 4$ is in $\{1,2\}$, then there are an odd number of odd numbers in the set $\{1,2,3, \ldots, n\}$; in particular, there are $\frac{n-1}{2}+1$ odd numbers in the set $\{1,2,3, \ldots, n\}$ iff $n \pmod 4 =1$, and there are $\frac{n-2}{2}+1$ odd numbers in the set $\{1,2,3, \ldots, n\}$ iff $n \pmod 4 =2$. Thus $\sum_{i=1}^n i$ is always odd for $n$ such that $n \pmod 4$ is either $1$ or $2$.
So let $j_1,\ldots, j_n$ be integers and let $A$ be the resulting number defined: $$A = \sum_{i=1}^n i \times (-1)^{j_i}.$$ Then $$\Big(\sum_{i=1}^n i\Big) - A = \sum_{i; \ j_i {\text{ odd}}} (i- (-i))$$ $$=\sum_{i; \ j_i {\text{ odd}}} 2i,$$ which is always even. As $(\sum_{i=1}^n i)$ is odd for $n$ such that $n \pmod 4$ is either $1$ or $2$, and the difference between $(\sum_{i=1}^n i)$ and $A$ is always even for all positive integers $n$, it follows that $A$ must be always odd for $n$ such that $n \pmod 4$ is either $1$ or $2$, and the result follows.