OFFSET
1,5
COMMENTS
The first 32 terms are distributed chaotically, after which the sequence alternates between 2 and n-6 indefinitely.
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
EXAMPLE
We start with a(1) = 0 and a(2) = 1. 1 has not appeared before, so we search for the greatest valid integer less than 1, which in this case is 0. 0 first occurred at a(1), which is 1 term before a(2) so a(3) = 1.
1 first occurred 1 term before, so a(4) = 1.
1 appeared at term a(1), which is 2 terms before a(4), so a(5) = 2.
2 has not appeared before, so we search for 1, which occurred 3 terms before at a(1). a(6) = 3.
And so on.
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robin Powell, Mar 17 2023
STATUS
approved