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$.
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$.
Copyright © 2021 JogjaFile Inc.
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):