login
A361172
a(n) is the smallest positive number not among the terms between a(n-1) and the previous most recent occurrence of a(n-1) inclusive; if a(n-1) is a first occurrence, set a(n)=1; a(1)=1.
3
1, 1, 2, 1, 3, 1, 2, 4, 1, 3, 5, 1, 2, 6, 1, 3, 4, 7, 1, 2, 5, 8, 1, 3, 6, 9, 1, 2, 4, 10, 1, 3, 5, 7, 11, 1, 2, 6, 8, 12, 1, 3, 4, 9, 13, 1, 2, 5, 10, 14, 1, 3, 6, 7, 15, 1, 2, 4, 8, 11, 16, 1, 3, 5, 9, 12, 17, 1, 2, 6, 10, 13, 18, 1, 3, 4, 7, 14, 19, 1, 2, 5, 8, 15, 20, 1
OFFSET
1,3
COMMENTS
The terms between two adjacent 1s must be strictly increasing.
The index of first occurrences appears to be A060432 (partial sums of A002024).
LINKS
EXAMPLE
a(11)=5 because between a(10)=3 and the previous 3 (3, 1, 2, 4, 1, 3), the smallest missing number is 5, so a(11)=5.
PROG
(PARI) { pos = [0]; v = 1; for (n = 1, #a = vector(86), print1 (a[n] = v", "); v = 1; if (a[n] <= #pos && pos[a[n]], r = Set(a[pos[a[n]]..n]); while (setsearch(r, v), v++)); while (#pos < a[n], pos = concat(pos, vector(#pos)); ); pos[a[n]] = n; ); } \\ Rémy Sigrist, Mar 04 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Mar 02 2023
STATUS
approved