Arithmetically repeating digit $1$ with interval of $n$ keeping rest of the digits $0$

60 Views Asked by At

I'm struggling to get a sequence of numbers $0$ and $1$ so that $1$ is repeating after a stable interval. For example:

$$\frac{(1-((-1)^{\lfloor\frac{n}{12}\rfloor} ((-1)^{\lfloor\frac{n}{11}\rfloor}))}{2}$$

will give:

0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,...

But what I really need is to repeat digit $1$ after every $12$ steps and keep rest of the digits $0$:

0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,

0,0,0,0,0,0,0,0,1,

I have tried with $mod$, $floor$, $ceiling$, $(-1)^n$ combinations, which I rather use instead of trigonometric functions or logical blocks, but haven't really made it.

1

There are 1 best solutions below

0
On

One way with floor and ceiling is

$$1-\left\lceil\frac{n-12\left\lfloor\frac{n}{12}\right\rfloor}{12}\right\rceil=\begin{cases}1&\text{if $n\equiv 0\pmod{12}$}\\0&\text{if $n\not\equiv 0\pmod{12}$}\end{cases}$$