Odd-Odd-Even-Even Sequence

I want a sequence that alternates between being an even integer and being an odd integer and I’ve come up with this sequence $ s_n=\lfloor \frac{n}{2} \rfloor $. So, it goes $0,1,1,2,2,3,3,\ldots$ and I was wondering if I can do something similar without using a floor or ceiling function. The important thing is that it goes back and forth between even and odd without simply alternating.

Solutions Collecting From Web of "Odd-Odd-Even-Even Sequence"

Well, one way to do it is $$ s_n = \frac{n + \frac{(-1)^n – 1} 2} 2 = \frac n 2 + \frac {(-1)^n} 4 – \frac 1 4. $$

This yields the exact same sequence as your formula: $0, 1, 1, 2, 2, 3, 3, \dotsc$

The way it works is that $\frac{(-1)^n – 1} 2$ equals $0$ if $n$ is even and $-1$ if $n$ is odd. Adding this to $n$ subtracts $1$ from each odd term, giving the sequence $0, 2, 2, 4, 4, 6, 6, \dotsc$, and dividing this by $2$ then produces your sequence.

The sum of the first $n$ integers, giving $n(n+1)/2$, is a simple example: $$1,3,6,10,15,21,28,36,45,55,\ldots$$

How about something like this?

$$F_n = F_{n-1} + F_{n-2} + F_{n-3}$$

where $F_1 = 0, F_2 = F_3 = 1$

You can prove that the series goes odd, odd, even, even, etc by adding in mod 2.