%I #23 Jan 02 2023 12:30:54
%S 1,1,2,3,8,5,18,49,129,338,209,80,31,13,57,158,417,1093,2862,7493,
%T 19617,51358,134457,352013,921582,2412733,6316617,16537118,43294737,
%U 70052356,26757619,10220501,3903884,1491151,569569,217556,83099,31741,12124,4631,1769,676,259,101,44
%N Start with a(0) = a(1) = 1. If a(n) = n is the rightmost term defined so far, let a(m) = m := n + a(n-1). If the terms between a(n) and a(m) are undefined, let a(n+1) = a(n) + a(m) and if m > n+1, a(m-1) = a(n+1) + a(m).
%C The term a(0) = 1 is by convention.
%C The first (smallest) term which is not a Fibonacci number (A000045) is a(6) = 18, cf. Example. Between two subsequent local minima of the form a(n) = n there is a finite Fibonacci-like subsequence having the two "boundary values" as initial terms, subsequent terms alternatingly to the left and to the right, and ending in a local maximum in the middle.
%C The sequence of successive rightmost terms (and also local minima, except for 2 and 3) is (1, 2, 3, 5, 13, 44, 145, 479, 1582, 5225, 17257, ...), cf. SeqFan post.
%H M. F. Hasler, in reply to Ali Sada, <a href="http://list.seqfan.eu/oldermail/seqfan/2020-March/020534.html">I need help with defining these 3 sequences</a>, SeqFan list, Mar 04 2020
%e After a(0) = a(1) = 1, the last term defined is a(n) = n with n = 1, so we let a(m) = m with m := n + a(n-1) = 1 + a(0) = 2, i.e., a(2) = 2.
%e Then the same rule applies again to give a(3) = 3, and once again to give a(5) = 5.
%e Now the term between a(3) and a(5) is undefined, and the second rule gives a(4) = a(3) + a(5) = 8. (The rules may in principle be applied in any order, but this a(4) is needed to compute the next term according to the first rule.)
%e Then the first rule applies again with n = 5. So we compute m = 5 + a(4) = 13, which gives a(13) = 13.
%e Now we have a gap of 7 undefined terms between a(5) and a(13). Following the second rule, we have a(6) = a(5) + a(13) = 18 and a(12) = a(6) + a(13) = 18 + 13 = 31. (These are the first terms which are not a Fibonacci number (A000045), since they are no more the sum of the two largest terms used so far.) We repeat (with n = 6, m = 12, etc.) until all "holes" are filled, although we can already now also apply the first rule to go further to the right:
%e As soon as we have computed a(12), we know that a(m) = m for m = a(13) + a(12) = 13 + 31 = 44. Then we can go further as soon as we have computed a(43), after a(14).
%o (PARI) {a=Vec(m=1,44); while(#a >= m = a[n=m]+a[n-(n>1)], a[m]=m; for(k=1,m-n-1, a[ if( k%2, n+k\/2, m-k\2 )] = a[n+k\2]+a[m-k\/2+1] )); a}
%Y Cf. A000045.
%K nonn
%O 0,3
%A _Ali Sada_ and _M. F. Hasler_, Mar 17 2020