Sequences with 0 as every other term
I was wondering what would be the general formula for a sequence given by:
f(0), 0, f(1), 0, f(2), 0, f(3), 0, ...
where the formula for f(n) for any non-negative integer is provided.
Specifically, I want a general formula for a sequence such as:
1, 0, 2, 0, 4, 0, 8, 0, 16, ...
Not stopping there, if the closed form for the first sequence is possible provided a closed for of f(n) is given, I wish to find the closed form for sequence:
f(0), 0, 0, f(1), 0, 0, f(2), ...
and generalize to a case when 'm' zeros are repeated between terms instead of just one or two.
Solution 1:
For given $m\geq 1$, the sequence with general term $$a_n=\lfloor|\cos(n\pi/m)|\rfloor$$ satisfies $a_0=a_m=a_{2m}=\dots=1$ and $a_n=0$ when $m\nmid n$.
Multiplying the $a_n$ by a desired factor answers your question.