[Math] Number sequence – arithmetic sequence difference constant – find formula

sequences-and-series

I searched a way to find out a formula to predict the nth number of a given sequence, but I did not find a way matching my case.

Arithmetic sequence:
I read that a good way is to find the constant difference.

Here is my sequence:
2,4,5,7,8,10,…
The differences are:
2,1,2,1,2,…

But I can't find a formula because the difference depends on the n variable and if the number is odd or even.
Docs I have read don't mention such case.

Best Answer

Try looking at the sequence as two separate sequences joined into one:

2,4,5,7,8,10...

=> 2,5,8,... and 4,7,10,...

If I denote the nth element in the original series as $a_n$, then :

If n is odd, $a_n = 2 + \frac{(n-1)}{2}*3$

If n is even, $a_n = 4 + \frac{n-2}{2}*3$