# General term of sequence 3

Let be $$6,8,12,15,20,24,30,35,42,…$$ a sequence of natural numbers. Guessing the recurrence then using generating functions I can prove that general term of sequence is $$a_n=\frac{1}{8}(2n^2+20n+45+3(-1)^n)$$ I think that my proof is too long. Any shorter more elementary proof.

-

Let $n=1$, the right side of your equation is $(1+20+45-3)/8=63/8$, so something's wrong.

Taking the odd index terms $6,12,20,30,42,\dots$, the first differences are $6,8,10,12,\dots$, the second differences are constant $2,2,2,\dots$, so the sequence is quadratic, $n^2+3n+2$.

The even index terms $8,15,24,35,\dots$, first difference $7,9,11,\dots$, second difference $2,2,\dots$, also quadratic, $n^2+4n+3$.

So we get $a_n=((n+1)/2)^2+3(n+1)/2+2$ if $n$ is odd, $a_n=(n/2)^2+2n+3$ if $n$ is even. Can you see how to combine those into a single formula?

-
sequnce starts at n=0 not by n=1 so I am not wrong – Adi Dani Aug 14 '11 at 11:37
@Adi: right; so why didn't you mention that piece in the question in the first place? – J. M. Aug 14 '11 at 12:10
@Adi, your formula sure as heck was wrong; if it wasn't wrong, you wouldn't have edited it to change $n^2$ to $2n^2$. Anyway, I've given you a solution that doesn't use generating functions and is probably shorter than the one you found; do you have anything positive to say about it? If you want to start at zero, it's easy enough to make an appropriate change to the formulas I give. – Gerry Myerson Aug 14 '11 at 12:37
@Gerry I knew those formulas for even and odd terms, question is how to get a single formula for general term. – Adi Dani Aug 14 '11 at 13:17
@Adi, $4a_n=n^2+8n+15$ if $n$ is odd, $4a_n=n^2+8n+12$ if $n$ is even, so $4a_n=n^2+8n+(27/2)-(3/2)(-1)^n$. – Gerry Myerson Aug 15 '11 at 1:15