# Nth term of the series where sign toggles after a triangular number

What could be the possible way to find the Nth term of following series where the sign toggles after each triangular number?

1 -2 -3 4 5 6 -7 -8 -9 -10 11 12 13 14 15 -16 -17 ....

The series cannot be in a Geometric Progression because there are 4 distinct triangular numbers in the above series.

-
Hint: the $n$-th term of your series is merely $(-1)^{f(n)} n$, for $n=1,2,\ldots$. You need to merely figure out what $f(n)$ is. – user1709 Oct 31 '10 at 14:17
A series is an infinite sum. Do you mean the $N$th term of the _sequence_, or do you want the $N$th partial sum of the series $1-2-3+4+5+6-7-\ldots$? – Hans Lundmark Oct 31 '10 at 14:25
@Hans: He has explicitly mentioned about finding out the Nth term in his post. – Prasoon Saurav Oct 31 '10 at 16:50
@Prasoon: Of course, but if he doesn't intend to add the numbers, I find it a bit unnecessary to talk about terms in a series instead of just numbers in a sequence. Especially when he writes down a sequence and calls it a series. ;) – Hans Lundmark Oct 31 '10 at 16:54

Using the formula for the triangular numbers we note that if $m \in I = [2n^2+n+1,2n^2+3n+1]$ for some $n=0,1,2,\ldots$ then $f(m)=m,$ otherwise $f(m)=-m.$

The only possible choice of $n$ is $\lfloor \sqrt{m/2} \rfloor,$ since if we write $l(n) = 2n^2+n+1$ and $u(n) = 2n^2+3n+1$ by writing $\sqrt{m/2} = N + r,$ where $N$ is an integer and $0 \le r < 1$ we have

$$u \left( \lfloor \sqrt{m/2} \rfloor – 1 \right) = 2N^2 – N < 2N^2+4Nr+r^2 < m,$$

and so $m \notin I.$ Similarly

$$l \left( \lfloor \sqrt{m/2} \rfloor + 1 \right) > m,$$

so $m \notin I.$ Hence we have

$$f(m) = m \textrm{ when } m \in [2t^2+t+1,2t^2+3t+1] \textrm{ for } t = \lfloor \sqrt{m/2} \rfloor,$$ otherwise $f(m)=-m.$

-