Almost Alternating sequence general formula We know that the typical alternating sequence has the term
$$
(-1)^n
$$
to represent a sequence of numbers that change in sign for every term.
Similarly, the 'almost alternating' sequence has the term
$$
(-1)^{n(n+1)/2}
$$
to represent a sequence of numbers that change in sign for every two terms. I was wondering whether there is a general formula for a sequence that alternates sign every $k$ terms. If there isn't a general formula, what is the formula for the "(-1)" term for sequences that alternate signs every $3$ and $4$ terms?
 A: If one begins with $n=0$ rather than with $n=1$ then
\begin{equation}
(-1)^{\left\lfloor\frac{n}{k} \right\rfloor}
\end{equation}
alternates $k$ positive followed by $k$ negative terms.
If one must begin with $n=1$ then use
\begin{equation}
(-1)^{\left\lfloor\frac{n-1}{k} \right\rfloor}
\end{equation}
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Leftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\, #2 \,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$$
\begin{array}{rcl}
\ds{2\,{1^{n} \over \color{#f00}{1}} - 1 = 1} & \ds{\imp} & \ds{1,1,1,1,\ldots}
\\[2mm]
\ds{2\,{1^{n} + \pars{-1}^{n} \over \color{#f00}{2}} - 1 = \pars{-1}^{n}} & \ds{\imp} & \ds{1,\color{#f00}{-1},1,\ldots}
\\[2mm] 
\ds{2\,{1^{n} + \pars{\expo{2\pi \ic/3}}^{n} + \pars{\expo{-2\pi \ic/3}}^{n} \over \color{#f00}{3}} - 1 =
} & \ds{\imp} & \ds{1,\color{#f00}{-1,-1},1\ldots}
\\[2mm]
\ds{2\,{1^{n} + \pars{-1}^{n} + \ic^{n} + \pars{-\ic}^{n} \over \color{#f00}{4}} - 1}
& \ds{\imp} & \ds{1,\color{#f00}{-1,-1,-1},1,\ldots}
\end{array}
$$
Now, $\color{#f00}{the\ idea}$ is: Take the $\ds{\pars{k + 1}}$ roots of $\ds{z^{k + 1} - 1 = 0}$ to get 'islands' of $k$ values of $\pars{-1}$ and play with the above procedure. Those expressions are friendly whenever we replace them in a series, etc$\ldots$.
