I am trying to find a formula for a sequence of the following numbers:
$$4,5,8,9,12,13,16,17,\dots$$
Can anyone help me or give me a hint on how to derive a formula?
I am trying to find a formula for a sequence of the following numbers:
$$4,5,8,9,12,13,16,17,\dots$$
Can anyone help me or give me a hint on how to derive a formula?
On
$$x_{n+1} = \begin{cases} x_n + 1 & \text{if}~n~\text{is even}\\ x_n + 3 & \text{if}~n~\text{is odd} \end{cases},$$
with $x_0 = 4$.
This can be rewritten also in a more compact form:
$$x_{n+1} = x_n + 2 - \cos(\pi n),$$
or equivalently
$$x_{n+1} = x_n + 2 - (-1)^n,$$
Note that $\cos(\pi n)$ (or equivalently, $(-1)^n$) represents a sequence of alternating $+1$ and $-1$ for $n \in \mathbb{N}.$ Therefor, $2-\cos(\pi n)$ is a sequence of alternating $+1$ and $+3$.
On
We look for the easy sequence that is similar to the original sequence, like $\left\{4,6,8,10,12,\dots\right\}$. We find that only the number of even term has inceased by $1$ from the original one. As the general term of $\left\{4,6,8,10,12,\dots\right\}$ is $2n+2$, we just need to find the general term of $\left\{0,-1,0,-1,0,\dots\right\}$, and add $2n+2$, then we finish.
As $\left\{0,-1,0,-1,0,\dots\right\}$ has a cycle of $2$, the general form of the sequence is $A\left(-1\right)^n+B$ where $A,B$ are constants. When we substitute $n=1,2$, we get$$\begin{cases} -A+B=0 \\ A+B=-1 \end{cases} \Rightarrow A=B=-\dfrac{1}{2}$$ So the general form of the sequence $\left\{0,-1,0,-1,0,\dots\right\}$ is $-\dfrac{1}{2}\left(-1\right)^n-\dfrac{1}{2}$.
Finally, add the general form of the two sequences and we get the general form of $\left\{4,5,8,9,12,\dots\right\}$ is $$\boxed{2n-\dfrac{1}{2}\left(-1\right)^n+\dfrac{3}{2}}$$
If define sequence as $\{a_1, a_2, \ldots\}$, then $$ \{a_n - n - 1\} = \{2,2, 4,4, 6,6, 8,8, \ldots\},\tag{1} $$ and the sequence $(1)$ can be described as $$ 2\left\lceil\frac{n}{2}\right\rceil. $$ Hence $$ a_n = n+1+2\left\lceil\frac{n}{2}\right\rceil\tag{2} $$ or $$ a_n = n+1+2\left\lfloor\frac{n+1}{2}\right\rfloor\tag{2'} $$ can be used.