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.


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$$

  • $\begingroup$ +1 The reason is that, as we increase $n$: $(n+1)|4$; then $n|4$; then $(n+1)|2$ but NOT $4$; then $n|2$ but NOT $4$. $\endgroup$ – BlueRaja - Danny Pflughoeft Feb 7 '12 at 18:22
  • 3
    $\begingroup$ Another way to see why this sequence has the desired property is that the difference between successive terms $s_{n-1}$ and $s_n$ is $n$. Adding an even number to $s_{n-1}$ does not change its evenness, whereas adding an odd number does. $\endgroup$ – Ilmari Karonen Feb 8 '12 at 11:13

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.