TITLE: Prove or disprove that $ \sum\limits_{k = 1 }^T f(k)=0 $ where $f(m)=\sum\limits_{n = 1 }^ m (-1)^n \sin(\frac{n(n+1)(2n+1)}{6}x) $
QUESTION [13 upvotes]: $$f(m)=\sum\limits_{n = 1 }^ m (-1)^n  \sin\left(\frac{n(n+1)(2n+1)}{6} \frac{a \pi}{b}\right) \tag 1 $$
Where $a,b,m$ positive integers. 
I have tested in WolframAlpha for many $a$ and $b$ values.
I conjecture (1) without proof that $f(m)$ function is periodic when $a,b,m$ positive integers and the sum of $f(m)$ is $0$ between period. 
Edit: In other way to express my claim above in my conjecture ($1$) that 
$ \sum\limits_{k = 1 }^T f(k)=0 $
where ($T$) is the period value. 
The wolframalpha link for testing some $a,b$ values
I also conjecture (2) without proof that the sum of $f(m)$ should be zero if $x$ is any real number.
$$f(m)=\sum\limits_{n = 1 }^ m (-1)^n  \sin\left(\frac{n(n+1)(2n+1)}{6}x\right) \tag 2 $$
$$ \lim\limits_{n \to \infty}\sum\limits_{k = 1 }^ n f(k)=0 \tag 3 $$

What is the period formula when $a,b$ are positive integers? 
Please help me to prove my conjectures 1 and 2 or disprove . 


Note that:$$\sum\limits_{k = 1 }^ n k^2=  \frac{n(n+1)(2n+1)}{6} $$
EDIT:
The period value is ($T$) and $f(m)$ satisfies $f(m)=f(m+kT)$ relation where $k$ is non-negative integer.
Period values for some $a,b$ values:
$a=3$, $b=17$ ,$x=\frac{3 \pi}{17} \Rightarrow T=68$  (this example is given in the link) and $ \sum\limits_{k = 1 }^{68} f(k)=0  $
$a=1$, $b=2$ ,$x=\frac{ \pi}{2} \Rightarrow T=8$ and $ \sum\limits_{k = 1 }^8 f(k)=0  $
$a=1$, $b=3$ ,$x=\frac{ \pi}{3} \Rightarrow T=36$ and $ \sum\limits_{k = 1 }^{36} f(k)=0  $
$a=1$, $b=4$ ,$x=\frac{ \pi}{4} \Rightarrow T=16$ and $ \sum\limits_{k = 1 }^{16} f(k)=0  $
$a=1$, $b=5$ ,$x=\frac{ \pi}{5} \Rightarrow T=20$ and $ \sum\limits_{k = 1 }^{20} f(k)=0  $
$a=1$, $b=6$ ,$x=\frac{ \pi}{6} \Rightarrow T=72$  and $ \sum\limits_{k = 1 }^{72} f(k)=0  $
$a=1$, $b=7$ ,$x=\frac{ \pi}{7} \Rightarrow T=28$  and $ \sum\limits_{k = 1 }^{28} f(k)=0  $
$a=2$, $b=7$ ,$x=\frac{ 2\pi}{7} \Rightarrow T=14$  and $ \sum\limits_{k = 1 }^{14} f(k)=0  $
$a=3$, $b=7$ ,$x=\frac{ 3\pi}{7} \Rightarrow T=56$  and $ \sum\limits_{k = 1 }^{56} f(k)=0  $
$a=4$, $b=7$ ,$x=\frac{ 4\pi}{7} \Rightarrow T=14$  and $ \sum\limits_{k = 1 }^{14} f(k)=0  $
$a=5$, $b=7$ ,$x=\frac{ 5\pi}{7} \Rightarrow T=28$  and $ \sum\limits_{k = 1 }^{28} f(k)=0  $
Thanks a lot for answers.
Please note that: I have posted a new question to generalize the problem. the link to the question

REPLY [3 votes]: 1. Settings and main results
Let $a$ and $b$ be relatively prime integers. Let $\theta, e, F $ be defined by
\begin{align*}
\theta_n = \frac{a}{b}\left(\sum_{k=1}^{n} k^2 \right) + n, \qquad
e_n = \exp\{i\pi\theta_n\}, \qquad
F_m = \sum_{n=1}^{m} e_n.
\end{align*}
(Here, we extend $\sum$ by additivity to allow non-positive arguments for $\theta$ and $F$.) This definition is related to OP's question by $f(m) = \operatorname{Im}\left( F_m \right)$. In view of this, we will prove the following result.

Proposition. The smallest positive period  $T_{\min}$ of $\{e_n\}$ is given by
  $$ T_{\min} = \frac{4\gcd(b, 3)}{\gcd(a, 2)}b. \tag{1} $$
  Moreover, $F$ has period $T_{\min}$ and satisfies 
  $$ \operatorname{Im} \left( \sum_{m=1}^{T_{\min}} F_m \right) = 0. $$

To establish this result, we aim to prove the following lemmas.


Lemma 1. An integer $T$ is a period of $\{e_n\}$ if and only if the following conditions hold
  $ $

$\text{(P1)} \ $ $T = 2bp$ for some integer $p$, and
$\text{(P2)} \ $ $2 \mid ap$ and $3 \mid ap(2bp+1)(4bp+1)$.



Lemma 2. Let $T$ be a period of $\{e_n\}$ and write $U = \frac{T}{2}$. Then

$e_{n+U} = e_U e_n$ and $e_{U-1-n} = -e_U \overline{e_n}$.
$e_U = \pm 1$ and $e_{U-1} = -e_U$.
If $e_U = 1$, then $U$ is also a period of $\{e_n\}$.



Let us see how this leads to the desired main result.
Proof of Proposition using Lemmas. It is easy to check that $\text{(1)}$ is the smallest positive $T$ satisfying both $\text{(P1)}$ and $\text{(P2)}$. Writing $U = T_{\min}/2$ for simplicity, it follows from the minimality of $T_{\min}$ and Lemma 2 that $U$ is not a period of $\{e_n\}$. In particular, we have $e_U = -1$. Then
$$ F_{T_{\min}}
= \sum_{n=1}^{U} (e_n + e_{U+n})
= \sum_{n=1}^{U} (e_n - e_n) 
= 0. $$
Moreover, since $e_{U-1} + e_U = 0$ and $e_{-1} + e_0 = 0$, we have
$$ F_U
= \sum_{n=-1}^{U-2} e_n
= \sum_{n=1}^{U} e_{U-1-n}
= \sum_{n=1}^{U} \overline{e_n}
= \overline{F_U}. $$
This implies that $\operatorname{Im}(F_U) = 0$. Finally, it follows that
$$ \sum_{m=1}^{T} F_m
= \sum_{m=1}^{U} (F_m + F_{U+m})
= \sum_{m=1}^{U} (F_m + F_U - F_m)
= UF_U $$
and therefore $ \operatorname{Im}\left(\sum_{m=1}^{T} F_m \right) = 0$ as required.

2. Proofs of lemmas
Before proving these claims, we introduce an auxlilary quantity which will be useful throughout the solution. Set
$$ \Delta_{m,n} = \theta_{m+n} - \theta_m - \theta_n = \frac{a}{b}mn(m+n+1). $$
It is obvious that $e_{m+n} = e_m e_n \exp\{i\pi\Delta_{m,n}\}$ holds for any $m, n$. In particular, this implies that
$$ \text{$T$ is a period of $\{e_n\}$}
\quad \Leftrightarrow \quad
\begin{cases}
\theta_T \equiv 0 \pmod{2}, \\
\Delta_{T,n} \equiv 0 \pmod{2} \ \forall n \in \mathbb{Z}
\end{cases} \tag{2}$$
Now we proceed to prove Lemma 1 first.
Proof of Lemma 1. One direction is almost immediate. Indeed, assume that both $\text{(P1)}$ and $\text{(P2)}$ hold. Then we easily check that both $\Delta_{n,T}$ and $\theta_T$ are even integers, hence $T$ is a period in view of $\text{(2)}$. So we focus on proving the other direction.
Assume that $T$ is a period of $\{e_n\}$. Using $\text{(2)}$, we know that both
$$ \Delta_{T,2} - 2\Delta_{T,1} = \frac{2aT}{b} \quad \text{and} \quad \Delta_{T,2} - 3\Delta_{T,1} = -\frac{aT^2}{b} $$
are all even integers. Since $a$ and $b$ are relatively prime, the first identity implies that $q = T/b$ is an integer and hence the same is true for $S = qa = aT/b$. Then the second identity tells that $2 \mid ST$. Now let us expand $\theta_T$ as
$$ \theta_T = \frac{S(T+1)(2T+1)}{6} + T = \frac{S(2T^2 + 1)}{6} + \frac{ST}{2} + T. $$
Since $\frac{ST}{2} + T$ is integer and $2 \nmid 2T^2 + 1$, we obtain $2 \mid S$. Then we find that $2 \mid T$ as well, for otherwise $6(\theta_T - T)$ is not a multiple of $4$ while $6(\theta_T - T) = S(T+1)(2T+1) $ is a multiple of $4$, which is a contradiction.
So far we have proved that $b \mid T$ and $2 \mid S, T$. Since $q = \gcd(S, T)$, we may write $q = 2p$, proving $\text{(P1)}$. Plugging this back to $\theta_T$,
$$ 0
\equiv \theta_T
\equiv \frac{S(T+1)(2T+1)}{6}
\equiv \frac{ap(2bp+1)(4bp+1)}{3} \pmod {2}, $$
from which $\text{(P2)}$ follows.  ////
Proof of Lemma 2. Let $T$ be a period of $\{e_n\}$ and let $p$ be as in Lemma 1. Write $U = \frac{T}{2}$. Then
$$ \Delta_{n,U} = apn(bpn+n+1)
\quad \text{and} \quad
\Delta_{n,U-1-n} = apn(bp-n-1) $$
are multiples of $ap$, which is even. So
$$e_{n+U} = e_n e_U \exp\{i\pi\Delta_{n,U}\} = e_n e_{U}.$$
Then plugging $n = U$ yields $1 = e_T = e_U^2$ and hence $e_U = \pm 1$. Similarly, 
$$e_{U-1} = e_n e_{U-1-n} \exp\{i\pi\Delta_{n,U-1-n}\} = e_n e_{U-1-n}. $$
Then plugging $n = -1$ yields $e_{U-1} = e_{-1}e_U = -e_U$ and $e_{U-1-n} = -e_U \overline{e_n}$ as required. Finally, if $e_U = 1$, then we have $e_{n+U} = e_n$ and therefore $U$ is also a period.  ////