zero's for odd and $\pm 1$ for even. Or $\pm 1$ for odd and zero's for even

93 Views Asked by At

What is the formula of the real function $f$ that satisfies

\begin{equation} \sum^{n}_{k=0}{f}=1+0+(-1)+0+1+0+(-1)+0+\cdots \end{equation}

or \begin{equation} \sum^{n}_{k=0}{f}=0+1+0+(-1)+0+1+0+(-1)+\cdots \end{equation} I found here : Does there exist a function which equals $0$ for odd inputs and $1$ for even inputs? a real function that equals $0$ for odd inputs of $k$ and $1$ for even inputs.

I need the first summation. The second summation comes from the first.

4

There are 4 best solutions below

1
On BEST ANSWER

Adjust the frequency and amplitude of a sine or cosine function. $$\cos(\pi n/2)$$

1
On

Try $$ (-1)^{n(n-1)/2}(-1)^\frac{1 + (-1)^n}{2}. $$

0
On

$$f(n)=\begin {cases}1&n\equiv 0 \pmod 4\\-1&n \equiv 2 \pmod 4\\0&\text{otherwise} \end {cases}$$

0
On

Finally, this is what I've got for the first summation

\begin{equation} (k+1)^3-4 \left\lfloor \frac{1}{4} \Big((k+1)^3+\alpha\Big)\right\rfloor, \end{equation} where $\alpha\in [1,3)$ is arbitrary. For the last sum, I replace $k$ with $k-1$ to get

\begin{equation} k^3-4 \bigg\lfloor \frac{1}{4} \big(k^3+\alpha\big)\bigg\rfloor,\qquad \alpha\in [1,3). \end{equation}