login
A328145
a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) + a(n-2) if a(n-1) > k, where k is each element in the ordered set M of integers not in 0 .. maximum(a(n-1)). Otherwise a(n+i) = a(n+i-1) - k, 0 <= i < #M.
1
0, 1, 1, 2, 3, 5, 1, 6, 2, 8, 4, 12, 5, 17, 10, 1, 11, 4, 15, 8, 23, 16, 7, 23, 14, 1, 15, 6, 21, 12, 33, 24, 11, 35, 26, 13, 39, 30, 12, 42, 33, 15, 48, 39, 21, 2, 23, 14, 37, 28, 10, 38, 29, 11, 40, 31, 13, 44, 35, 17, 52, 43, 25, 6, 31, 22, 4, 26, 17, 43, 34, 16, 50, 41, 23, 4, 27, 18, 45, 36
OFFSET
0,4
COMMENTS
The sequence has the same next-term addition rule as the Fibonacci sequence A000045. However any number between 0 and the maximum value of a(0)..a(n) that has not appeared in the sequence is added to an ordered set M of missing numbers. These are subsequently subtracted from a(n-1) to form a(n), a(n+1)..a(n+i) as long as the resulting a(n) >= 0. At any time if a(n) appears in the set of currently missing numbers that number is removed from the set.
The sequence has 137 non-repeating values, the largest being 55, and the last element being 49. Beyond this the final 30 values of the sequence 30, 10, 40, 21, 1, 22, 3, 25, 6, 31, 12, 43, 24, 4, 28, 9, 37, 18, 55, 36, 16, 52, 33, 13, 46, 27, 7, 34, 15, 49 repeat forever, with an unchanging set M of missing values {19,20,32,47,51,54}.
LINKS
EXAMPLE
a(0..5) = 0,1,1,2,3,5. As 4 was skipped it is added to the set M of missing values, so M = {4}. As a(5) >= 4 the next value is thus a(6) = 5 - 4 = 1. As there are no more missing numbers to process, the addition rule starts again, so a(7) = 5 + 1 = 6.
a(9) = 6 + 2 = 8. which skips 7, so M = {4,7}.
a(10) = 8 - 4 = 4, which removes 4 from M. As the remaining missing value 7 is greater than 4, the next value is a(11) = 4 + 8 = 12, which adds 9, 10, 11 to M so M = {7,9,10,11}.
a(13) = 17 - 7 = 10, removing 10 from M. But 10 is also larger than the next missing value 9, thus a(14) = 10 - 9 = 1. a(15) = 10 + 1 = 11, removing 11 from M.
The value 7 is eventually reached at a(22), and 9 at a(92). After 137 values the above given series of 30 values repeats with M = {19,20,32,47,51,54}.
CROSSREFS
Cf. A000045.
Sequence in context: A256655 A128047 A105870 * A096534 A322558 A139047
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Oct 05 2019
STATUS
approved