login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A361614
Set a(1)=0 and a(2)=1. For n > 1, if a(n) has already appeared in the sequence, then a(n+1) = number of steps since its first appearance. If a(n) has not appeared before, search instead for a(n)-1, then a(n)-2, etc., until you find a number that has appeared before.
0
0, 1, 1, 1, 2, 3, 1, 5, 2, 4, 4, 1, 10, 5, 6, 7, 1, 15, 5, 11, 7, 5, 14, 3, 18, 7, 10, 14, 5, 21, 5, 23, 2, 28, 2, 30, 2, 32, 2, 34, 2, 36, 2, 38, 2, 40, 2, 42, 2, 44, 2, 46, 2, 48, 2, 50, 2, 52, 2, 54, 2, 56, 2, 58, 2, 60, 2, 62, 2, 64, 2, 66, 2, 68, 2, 70, 2
OFFSET
1,5
COMMENTS
The first 32 terms are distributed chaotically, after which the sequence alternates between 2 and n-6 indefinitely.
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
Sequence in context: A075014 A304880 A086686 * A306807 A021816 A055023
KEYWORD
nonn,easy
AUTHOR
Robin Powell, Mar 17 2023
STATUS
approved