Find a linear recurrence which gives every integer exactly once.

86 Views Asked by At

Find a linear recurrence which gives every integer exactly once.

$a_n$ = $a_{n-1} - 1$ or $a_n$ = $a_{n-1} + 1$
gives only the negative integers or poitive integers not both when we set $a_0= 0$.

1

There are 1 best solutions below

4
On BEST ANSWER

Hint:

Such a sequence could look like this:

$$0,1,-1,2,-2,3,-3,\dots$$

Try constructing the recurrence relation by using $(-1)^n$.


Solution (don't look until you've tried):

$$a_{n+1}=a_n+(-1)^n(n+1) \quad \quad \text{with }\; a_0=0.$$