Complex expression for periodic binary sequences

We have infinite binary sequences of type $$\langle g_n \rangle_{j=4}=\{0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,...\} \,;\, n\to\infty$$ where $j$ indicates the length of a period that starts/ends with a $1$; otherwise zero.

We know that for $j=4$ we could use following complex expression to express the sequence: $$(1/4)(1^n+i^n+(-1)^n+(-i)^n)$$ However, does anybody may help how we could parametrize and find such an expression for all integers $j>2$

Many thanks

-
The Answer is iderntical to "[Fourier expression for infinite recurring binary sequence][1]" [1]: math.stackexchange.com/questions/362351/… – al-Hwarizmi Jun 3 '13 at 8:15

The formula $\frac{1}{4}(1^n+i^n+(-1)^n+(-i)^n)$ is derived from the following general Fourier series equations:

$g[n]_{j} = \sum \limits_{k=<j>}^{} a_{k} \cdot \exp\{ ik\frac{2\pi}{j}n\}$

$a_k = \frac{1}{j}\sum \limits_{n=<j>}^{} g[n] \cdot \exp\{-ik\frac{2\pi}{j}n\}$

NOTE: As an electrical engineer, I don't see why $j$ should be used as the period of the signal. We use $j$ instead of $i$ to denote the imaginary number.

Though it may not seem so, there is an intuitive pattern hidden within the expression $\frac{1}{4}(1^n+i^n+(-1)^n+(-i)^n)$. There is $\frac{1}{j}$ in the front of the sequence and $j$ expressions which represents $j$ evenly spaced segments of the unit circle. This might make more sense with an example:

For $j = 3$,

$g[n]_{3} = \frac{1}{3}(1^n+(-\frac{1}{2}+\frac{\sqrt{3}}{2}i)^n +(-\frac{1}{2}-\frac{\sqrt{3}}{2}i)^n)$ (corresponds to $0, 2\pi/3,$ and $4\pi/3$ on the unit circle)

If $\zeta\in\mathbb C$ is a primitive $j$th root of unity, then $$\frac1j\sum_{k=0}^{j-1}\zeta^{nk}=\begin{cases}1&\text{if } j|n,\\0&\text{otherwise}.\end{cases}$$ This works for all $j\ge1$ and includes your formula as a special case (with $\zeta=i$ or $\zeta=-i$, as you like).
Thanks. Indeed when we apply this Sum for $n=j$ we get a full sequence of $1$s and otherwise a full sequence of $0$s. But still a question to us how we get a period of $1$ and $0$? Probably we did not understand well. May you help? – al-Hwarizmi Apr 15 '13 at 18:38