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 A064388 #18 Jun 01 2025 23:55:48 %S A064388 1,3,6,2,7,13,20,12,21,11,22,10,23,9,24,8,25,43,62,42,63,41,18,44,17, %T A064388 45,16,46,15,47,14,48,83,119,82,120,81,121,80,38,84,37,85,36,86,35,87, %U A064388 34,88,33,89,32,90,31,91,30,92,29,93,28,94,27,95,26,96,167,239,166,240 %N A064388 Variation (3) on Recamán's sequence (A005132): set s (the step size) initially equal to 2; to get a(n), we first try to subtract s from a(n-1): a(n) = a(n-1)-s if positive and not already in the sequence, in which case we change s to s+1; if not, a(n) = a(n-1)+s+i, where i >= 0 is the smallest number such that a(n-1)+s+i has not already appeared and now we change s to s+i+1. %C A064388 Variation (4) (A064389) is the nicest of these variations. %C A064388 I would also like to get the following sequences: number of steps before n appears (or 0 if n never appears), list of numbers that never appear, height of n (cf. A064288, A064289, A064290), etc. %H A064388 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a> %o A064388 (BASIC) %o A064388 rem Chipmunk BASIC v3.6.4(b8) http://www.nicholson.com/rhn/basic/ %o A064388 max=1000 : dim a(max) %o A064388 s=2 : z=1 : a(z)=1 : print str$(z)+","; %o A064388 for n=1 to 200 %o A064388 x=z-s : if x <= 0 then goto yyy %o A064388 if a(x)=0 then a(x)=1 : print str$(x)+","; : s=s+1 : z=x : goto xxx %o A064388 yyy: for i=0 to max %o A064388 x=z+s+i %o A064388 if a(x)=0 then a(x)=1 : print str$(x)+","; : s=s+i+1 : z=x : goto xxx %o A064388 next i %o A064388 xxx: next n %o A064388 print : end %o A064388 rem _Jeremy Gardiner_, Feb 22 2014 %Y A064388 Cf. A005132, A046901, A064387, A064389. %K A064388 nonn,easy %O A064388 1,2 %A A064388 _N. J. A. Sloane_, Sep 28 2001 %E A064388 More terms from _David Wasserman_, Jul 16 2002