I am wondering if it is possible to construct an alternating sequence of $j$ ones followed by $k$ zeros.
For $j=1,k=1$, I can use:
- $a_n=\frac{1+(-1)^{n-1}}{2}$
But now, I can’t find any other sequences to go off of from there.
How can I get one for any $j,k\in\mathbb{N}$?
If this is not possible, is there any way to get a general formula where $j$ and $k$ represent the number of odd and even numbers in an alternating sequence instead of ones and zeros, respectively?
A sequence of $\,k\,$ arbitrary values $\,a_0, a_1, \dots,a_{k-1}\,$ can be extended to an infinite periodic sequence by recursively defining $\,a_{n}=a_{n-k}\,$ for $\,n \ge k\,$.
That is a linear homogeneous recurrence with constant coefficients whose general solution is $\,a_n = c_1 \omega_1^n + c_2 \omega_2^n + \dots + c_k \omega_k^n$ where $\,\omega_1, \omega_2,\dots,\omega_k\,$ are the roots of the characteristic polynomial $\,z^k - 1\,$. In this case the roots are the $\,k\,$ different $\,k^{th}\,$ roots of unity, and the constants $\,c_1, c_2, \dots, c_k\,$ are determined such that the formula matches the initial values $\,a_0, a_1, \dots, a_{k-1}\,$.
For an example, suppose $\,k=4\,$ and $\,a_0=a_1=1, a_2=a_3=0\,$. Then the $\,4\,$ fourth roots of unity are $\omega_{1,2}=\pm1, \omega_{3,4}=\pm i\,$, so $\,a_n = c_1 + c_2\,(-1)^n+c_3\,i^n+c_4\,(-i)^n\,$ where the constants are determined by solving the system:
$$ \begin{align} \begin{cases} a_0 = c_1 + c_2 + c_3 + c_4 &= 1 \\ a_1 = c_1 - c_2 + c_3\,i - c_4\,i &= 1 \\ a_2 = c_1 + c_2 - c_3 - c_4 &= 0 \\ a_3 = c_1 - c_2 - c_3\,i + c_4\,i &= 0 \end{cases} \end{align} $$
In the end $\,c_1=\dfrac{1}{2}, c_2=0, c_3=\dfrac{1-i}{4}, c_4=\dfrac{1+i}{4}\,$, and it can be easily verified that $\,a_n = \dfrac{2 + (1 - i)\,i^n + (1 + i) \,(-i)^n}{4}\,$ does indeed define the repeating sequence $\,1,1,0,0,1,1$...