# Formula for a periodic sequence of 1s and -1s with period 5

I've been playing with periodic sequences of 1s and -1s lately. This is what I came up with: \begin{eqnarray*} -(-1)^n& = &1, -1, 1, -1,\ldots\quad\textrm{(Period 2)}\\ \left(-(-1)^n\right)^{\frac{n+2}{2}} & = &1, 1, 1, -1, 1, 1, 1, -1,\ldots\quad\textrm{(Period 4)}\\ \left(\left(-(-1)^n\right)^{\frac{n+2}{2}}\right)^{\frac{n+4}{4}}& = &1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, \ldots\quad\textrm{(Period 8)} \end{eqnarray*} One can easily find a similar formula for a periodic sequence with period $2^n, n\in\mathbb{N}$. I also found a formula: $$(-1)^{2 \sin\left(\frac{(2n-1)\pi}{6}\right)},$$ which gives a sequence $-1, 1, -1, -1, 1, -1,\ldots$ with period 3.

My question is: Is there a formula for a periodic sequence of 1s and -1s with period 5? If there is, what is it?

I know about this formula for a periodic zero and one sequence with period $N$: $$\sum\limits_{k = 1}^N\cos\left(-2\pi\frac{n(k-1)}{N}\right)/N = 0, 0, 0, \ldots, 1.$$ However, it requires to sum up $N$ expressions to count the $n\textrm{th}$ term, which is why I don't like it. I would also like the formula not to contain functions like floor or modulus.

• Wouldn't at this point the more natural question be finding a formula with period $3$ without using an "advanced" function like the sine? Dec 10, 2014 at 15:07
• Also, must the formula with a period $n$ produce $n-1$ positive 1's followed by a single negative 1 before the pattern repeats? Dec 10, 2014 at 15:14
• @GDumphart I thought about this too, but I don't think it exists. "Less advanced" functions (polynomials) give a sequence of even and odd numbers with period $2^n$, don't they? Dec 10, 2014 at 15:20
• @teadawg1337 Not necassarily. It can by any sequence of positive and negative 1's with period 5. Dec 10, 2014 at 15:22
• In that case, my topic here gives two different examples with period 4. Perhaps that can help get the ball rolling Dec 10, 2014 at 15:26

We have $$\frac{4\cos\left(\frac{2\pi k}5\right)+4\cos\left(\frac{4\pi k}5\right)-3}5= \left\{\begin{array}{} -1&\text{if }k\not\equiv0\pmod5\\ +1&\text{if }k\equiv0\pmod5\\ \end{array}\right.\tag{1}$$

Explanation

The roots of $z^5-1$ are $z=e^{2\pi ik/5}$ for $k\in\{0,1,2,3,4\}$. Vieta says that the coefficient of $z^4$ in $z^5-1$ the sum of the roots of $z^5-1$. That is, the sum of the roots is $0$. Taking the real part of the roots yields $$1+\cos\left(\frac{2\pi}5\right)+\cos\left(\frac{4\pi}5\right)+\cos\left(\frac{6\pi}5\right)+\cos\left(\frac{8\pi}5\right)=0\tag{2}$$ When $k\not\equiv0\pmod5$, $k$ is invertible $\bmod5$. Therefore, $$\left(\cos\left(\frac{2\pi k}5\right),\cos\left(\frac{4\pi k}5\right),\cos\left(\frac{6\pi k}5\right),\cos\left(\frac{8\pi k}5\right)\right)\tag{3}$$ is a permutation of $$\left(\cos\left(\frac{2\pi}5\right),\cos\left(\frac{4\pi}5\right),\cos\left(\frac{6\pi}5\right),\cos\left(\frac{8\pi}5\right)\right)\tag{4}$$ Therefore, $$1+\cos\left(\frac{2\pi k}5\right)+\cos\left(\frac{4\pi k}5\right)+\cos\left(\frac{6\pi k}5\right)+\cos\left(\frac{8\pi k}5\right)=0\tag{5}$$ when $k\not\equiv0\pmod5$. When $k\equiv0\pmod5$, $$1+\cos\left(\frac{2\pi k}5\right)+\cos\left(\frac{4\pi k}5\right)+\cos\left(\frac{6\pi k}5\right)+\cos\left(\frac{8\pi k}5\right)=5\tag{6}$$ Since $\cos(x)$ is an even function with period $2\pi$, $(5)$ and $(6)$ become $$1+2\cos\left(\frac{2\pi k}5\right)+2\cos\left(\frac{4\pi k}5\right) =\left\{\begin{array}{} 0&\text{if }k\not\equiv0\pmod5\\ 5&\text{if }k\equiv0\pmod5\\ \end{array}\right.\tag{7}$$ Equation $(1)$ is simply a scaled and translated version of $(7)$.

• I will continue to think on this.
– robjohn
Dec 10, 2014 at 15:49
• Thank you! But why do $\cos\left(\frac{2\pi k}{5}\right)$ and $\cos\left(\frac{4\pi k}{5}\right)$ sum up so nicely? Dec 10, 2014 at 15:58
• @Mikulas: I have added an explanation of that.
– robjohn
Dec 10, 2014 at 16:27
• You probably want $=-1$ in (1) to make it an equation. Well done Dec 10, 2014 at 16:33
• @RossMillikan: thanks; fixed.
– robjohn
Dec 10, 2014 at 16:43

Surprisingly, you can use Fibonacci numbers and its generalizations for periods $3,4,5,\dots$

Period 3. Fibonacci numbers $F_n= 1, 1, \color{blue}2, 3, 5, \color{blue}8, 13, 21, \color{blue}{34},\dots$

$$A_n = -(-1)^{F_n}=1, 1, -1, 1, 1, -1,\dots$$

Period 4. Tribonacci numbers $T_n = 1, 1, \color{blue}{2, 4}, 7, 13, \color{blue}{24, 44}, 81, 149, \color{blue}{274, 504},\dots$

$$B_n = -(-1)^{T_n}=1, 1, -1, -1, 1, 1, -1, -1\dots$$

Period 5. Tetranacci numbers $W_n = 1, 1, 1, 1, \color{blue}4, 7, 13, 25, 49, \color{blue}{94}, 181, 349, 673, 1297, \color{blue}{2500},\dots$

$$C_n = -(-1)^{W_n}=1, 1, 1, 1, -1, 1, 1, 1, 1, -1,\dots$$

and so on.

• Nice approach, +1 Dec 14, 2016 at 11:23
• A closed-form for the tribonacci numbers in terms of binomial coefficients can be found here. Dec 14, 2016 at 12:51

This is close:

${|\cos{\frac{\pi*x}{5}-\frac{\pi}{2}}|}^{0.0001}$

• Your formula gives just numbers close to 1. Dec 10, 2014 at 15:45
• @Mikulas , I know, that's the problem, that's why I said it was close Dec 12, 2014 at 13:33