What is formula for repeating sequence $0, 0, 1, 1, 0, 0, 1, 1, ...$ can somebody help me with this? I was searching through the web and I did not find anything useful. What is the formula for the sequence:
$0, 0, 1, 1, 0, 0, 1, 1, ...$
or
$0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, ...$
I did find solution for $0,1,0,1$ or $1,0,1,0$ or $0,0,0,1$ etc.. But nothing close to this.
Thank you in advance!
EDIT:
Sorry everyone, I am quite new to this. It is a repeating infinite series. Also, I am looking for a more general solution so I can choose the number of zeros and ones - if $n = 3$ then I am looking for a repeating sequence:
$0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, ...$
EDIT2:
Example: I input let say "$k$" into a formula. I'll get $0$ or $1$ as an output. I use "$n$" as a variable for a function that will determine the repairing pattern e.g. If $n=2$ then the pattern is $0,0,1,1,0,0,1,1,0,0,1,1, ...$ and if $k=3$, then the output will be the third position, which is $1$ in this case.
 A: The simplest way:
$$
a_k=\frac{1\pm(-1)^{\left\lfloor\frac {k-1}n\right\rfloor}}2,
$$
where $n$ is the half-period of the sequence and with $\pm$ sign you can choose to start with $0$ or $1$.
A: Here is a formula based on another point of view.
Notice that

*

*$\operatorname{base_2}(0,\overline{01})=\frac 13$

*$\operatorname{base_2}(0,\overline{0011})=\frac 15$

*$\operatorname{base_2}(0,\overline{000111})=\frac 19$

*$\operatorname{base_2}(0,\overline{00001111})=\frac 1{17}$
It is not too complicated to verify that with $n$ zeroes and ones ($n$ being the half-period as in user's answer) then (where $x^n$ denotes the digits $\underbrace{xx\cdots x}_\text{n times}$)
$$\operatorname{base_2}(0,\overline{0^n1^n})=\frac 1{2^{n}+1}$$
So if we multiply by $2^k$ then the unit digit is either the $0$ or the $1$ at place $k$ in the binary development, giving the formula below:
$$a_k=\left\lfloor\frac{2^k}{2^n+1}\right\rfloor \bmod 2$$
It is more interesting theoretically than as a practical way of calculating these numbers though...

The formula based on powers of $(-1)^\alpha$ can be written with the floor function directly.
I think one efficient way of computing this sequence could be the following
$$a_k=\left\lfloor\frac kn\right\rfloor-2\left\lfloor\frac k{2n}\right\rfloor$$
The concept is simple, $\lfloor\frac x{2n}\rfloor$ has a period double than $\lfloor\frac x{n}\rfloor$, we multiply by $2$ so that both functions overlap on period $n$, their difference is then $0$, and on the remaining of the period it is $1$, giving birth to a $0^n1^n$ sequence of period $2n$.
A: If you accept boolean logic, then you can use following formula:
$$ a_k = \frac{(k \space AND \space 2)}{2} $$
Which will produce: 0 0 1 1 0 0 1 1 ....
To produce 0 1 0 1 0 1 0 1 0 1
You can use $$ a_k = \frac{(k \space AND \space 1)}{1} $$
In general it would be $$ a_k = \frac{(k \space AND \space c)}{c} $$ where c is the power of 2 which is it's main drawback.
