# closed form sequence

• Jun 8th 2009, 09:39 PM
geoffl
closed form sequence
The problem: Find a closed form of the following sequence 0,3,2,5,4,7,6,9,8,11,10,13,12.

So I get that the odds are n-1 and the evens are n+1 and I've started the equation and so far I have $((-1)^(n-1) + 1)/2 + ((-1)^n + 1)/2)$ (the first part is supposed to be (-1)^(n-1)) the first half to find the odd numbers and the second to find the even numbers.

I'm having trouble coming up with where to put the n-1 and n+1. Any help or hints is appreciated.

Thanks.
• Jun 8th 2009, 09:55 PM
geoffl
nevermind.... im dumb.

thanks anyways.
• Jun 9th 2009, 04:06 PM
Soroban
Hello, geoffl!

You're not dumb . . . If you are, you've got company.

Quote:

Find a closed form for the sequence: 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12.

I too got distracted by the odd/even subsequences

. . and got involved with $\frac{1-(\text{-}1)^n}{2}$ and $\frac{1 + (\text{-}1)^n}{2}$ . (the "blinker functions")

It took me a while to see a simpler explanation.

. . If $n$ is odd, subtract 1 from $n$.
. . If $n$ is even, add 1 to $n$.

Therefore: . $f(n) \;=\;n + (\text{-}1)^n$