Formula for sequence of numbers

47 Views Asked by At

I am trying to find a somewhat nice general formula for the following sequence.

$2,2,6,6,10,10,14,14,\dots$

I found one on wolfram alpha, however I am not sure how to derive it; I am also wondering if there is a more simple version.

Wolfram Alpha Solution: $(-1)^n(2(-1)^nn+(-1)^{n+1}-1)$

2

There are 2 best solutions below

2
On BEST ANSWER

What about

$$4\left\lfloor\frac{n-1}2\right\rfloor+2\ ?$$

0
On

however I am not sure how to derive it; I am also wondering if there is a more simple version.

$$\begin{array}{cccccccc} & 2 & 2 & 6 & 6 & 10 & 10 & 14 & 14 & \dots \\ = & \color{blue}{1}\color{red}{+1} & \color{blue}{3}\color{red}{-1} & \color{blue}{5}\color{red}{+1} & \color{blue}{7}\color{red}{-1} & \color{blue}{9}\color{red}{+1} & \color{blue}{11}\color{red}{-1} & \color{blue}{13}\color{red}{+1} & \color{blue}{15}\color{red}{-1} & \ldots \end{array}$$

So take odd numbers and alternate between adding and subtracting $1$:

$$\color{blue}{2n-1} \color{red}{- (-1)^n}$$