This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A308419 #20 May 09 2025 00:37:55 %S A308419 24,24,13,21,3,3,3,15,6,6,6,15,12,9,9,9,16,20,15,12,12,12,8,10,12,20, %T A308419 15,15,15,10,15,24,22,26,18,18,18,11,13,18,29,28,27,21,21,21,15,13,19, %U A308419 17,25,31,23,24,24,24,16,18,20,21 %N A308419 Stopping time for Recamán-like iteration of each n: a(0) = n, a(k) = a(k-1) - k if positive and not already in the sequence, a(k) = a(k-1) + k if not already in the sequence, otherwise stop. %C A308419 a(0) is the index of the first repeated value in Recamán's sequence (A005132). %C A308419 a(n) appears to grow like sqrt(2n). %F A308419 a(n) >= ceiling((sqrt(1 + 8*n)-1)/2). - _Markel Zubia_, May 03 2025 %e A308419 For n = 8, the Recamán-like sequence generated is 8, 7, 5, 2, 6, 1; the sequence halts after a(8) = 6 terms since 1 - 6 = -5 is negative and 1 + 6 = 7 is already in the sequence. %o A308419 (Python) %o A308419 def seqr(n): %o A308419 sequence = [n] %o A308419 i = 1 %o A308419 while True: %o A308419 if n - i > 0 and n - i not in sequence: %o A308419 n -= i %o A308419 sequence.append(n) %o A308419 elif n + i not in sequence: %o A308419 n += i %o A308419 sequence.append(n) %o A308419 else: %o A308419 break %o A308419 i += 1 %o A308419 return len(sequence) %o A308419 print([seqr(n) for n in range(1000)]) %Y A308419 Iteration rule nearly identical to A005132. %Y A308419 A334219 is essentially the same sequence. %K A308419 nonn %O A308419 0,1 %A A308419 _Kevin J. Gomez_, May 25 2019