How do I find a formula $a_n$ for the following periodic sequence: $$0,1,3,4,4,3,1,0,0,1,3,4,4,3,1,0,...$$
The period of the above sequence is 8 with sub-sequence $\{0,1,3,4,4,3,1,0\}$ repeating.
How do I find a formula $a_n$ for the following periodic sequence: $$0,1,3,4,4,3,1,0,0,1,3,4,4,3,1,0,...$$
The period of the above sequence is 8 with sub-sequence $\{0,1,3,4,4,3,1,0\}$ repeating.
On
I got the discrete function $a(n)$ as
$$a_n=3-\lfloor|3.5-((n-1)\ mod\ 8)|\rfloor+\lfloor\frac{3-\lfloor|3.5-((n-1)\ mod\ 8)|\rfloor}{2}\rfloor$$
Though it looks very sophisticated it can be very easily obtained.
My approach:
I have tried to approach the problem logically.
First try finding $a(x)$ for $x=1,2,...,8$. Later we can replace $x$ with $((n-1)\ mod\ 8) +1$
Since it is symmetric around $4.5$, the function has some component of form $\pm|4.5-x|$ (i.e. $\pm\{3.5,2.5,1.5,0.5,0.5,1.5,2.5,3.5\}$).
We can manipulate the above form to obtain $3-\lfloor|4.5-x|\rfloor$ (i.e $\{0,1,2,3,3,2,1,0\}$).
To obtain the desired sequence $$\displaystyle\{0,1,3,4,4,3,1,0\}=\{0,1,2,3,3,2,1,0\}+\lfloor\frac{\{0,1,2,3,3,2,1,0\}}{2}\rfloor$$ just add $\displaystyle \lfloor\frac{3-\lfloor|4.5-x|\rfloor}{2}\rfloor$.
So we have $$a(x)=3-\lfloor|4.5-x|\rfloor+\lfloor\frac{3-\lfloor|4.5-x|\rfloor}{2}\rfloor$$
To get $a(n)$ for all natural numbers n put $x\rightarrow((n-1)\ mod\ 8) +1$
https://en.wikipedia.org/wiki/Periodic_sequence#Periodic_0.2C_1_sequences
You need to add up a linear combination of 8 of these sequences, and you're done.