%N A variation on Recamán's sequence (A005132): to get a(n), we first try to subtract n from a(n-1): a(n) = a(n-1)-n if positive and not already in the sequence; if not then a(n) = a(n-1)+n-i, where i >= 0 is the smallest number such that a(n-1)+n-i has not already appeared.
%C Is it ever impossible to extend the sequence -- meaning there is no number less than a(n-1)+n which has not appeared?
%C After 10^11 terms, the smallest number which has not appeared is 609790506.
%H Benjamin Chaffin, <a href="/A277558/b277558.txt">Table of n, a(n) for n = 0..10000</a>
%e a(23) = 18. To get a(24) we try 18-24, but that is negative; so we try 18+24 = 42, but 42 has already appeared; so we try 18+24-1, but 41 has also already appeared; so we try 18+24-2. 40 is positive and has not yet appeared, and so a(24) = 40.
%Y Cf. A005132, A064387 (chooses a(n-1)+n+i instead of a(n-1)+n-i).
%A _Benjamin Chaffin_, Oct 19 2016