Recrusive on integer

47 Views Asked by At

I have a set of integers as follow:

1,2,4,5,7,8,9,10,11,12,13 ...

And I would like to have a close recursive form of the sort 3*(n+1)-1 where, for a given n I can be able to compute the related integer of the sequence.

Unfortunately, the sequence is somehow not uniform, since the difference between consecutive integer is not every time the same:

1,2,1,2,1,1,1,...,1

The problem as one can see, is the two 2 at the second and fourth position of the series given by the 4-2 and 7-5 all the other integers up to infinity as a consecutive difference of 1 (i.e.: 13-12) . So my question is, do exist a close form to express this recurrence of number?

Many thanks for your help.

1

There are 1 best solutions below

1
On BEST ANSWER

Using the floor function $\lfloor \cdot \rfloor$ your sequence can be described by the formula $$n+2-\lfloor \frac{4}{n} \rfloor +2 \cdot\lfloor \frac{1}{n} \rfloor$$