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 A080096 #17 Sep 11 2024 02:26:59 %S A080096 1,1,2,0,3,1,2,2,1,3,0,4,1,3,2,2,3,1,4,0,5,1,4,2,3,3,2,4,1,5,0,6,1,5, %T A080096 2,4,3,3,4,2,5,1,6,0,7,1,6,2,5,3,4,4,3,5,2,6,1,7,0,8,1,7,2,6,3,5,4,4, %U A080096 5,3,6,2,7,1,8,0,9,1,8,2,7,3,6,4,5,5,4,6,3,7,2,8,1,9,0,10,1,9,2,8,3,7,4,6,5 %N A080096 a(1) = a(2) = 1, a(3) = 2, thereafter a(n) = abs(a(n-1) - a(n-2) - a(n-3)). %H A080096 Reinhard Zumkeller, <a href="/A080096/b080096.txt">Table of n, a(n) for n = 1..10000</a> %F A080096 For n>=3 Max( a(k) : 1<=k<=n ) = floor ( sqrt(n+4)). %F A080096 Special cases: a(n^2 + 4*n - 1) = 0 and a(n^2 - 4) = n. %F A080096 a(A028557(n)) = a(A028557(n+1)). %F A080096 Sum_{k=(n-1)^2 .. n^2} a(k) = n^2. %t A080096 nxt[{a_,b_,c_}]:={b,c,Abs[c-b-a]}; NestList[nxt,{1,1,2},110][[All,1]] (* _Harvey P. Dale_, Nov 14 2021 *) %o A080096 (PARI) a(n)=local(k,m); if(n<1,0,k=sqrtint(n+4); m=n+4-k^2; if(m%2,m\2+1,k-m\2)) %o A080096 (Haskell) %o A080096 a080096 n = a080096_list !! (n-1) %o A080096 a080096_list = 1 : 1 : 2 : zipWith3 (\u v w -> abs (w - v - u)) %o A080096 a080096_list (tail a080096_list) (drop 2 a080096_list) %o A080096 -- _Reinhard Zumkeller_, Oct 11 2014 %o A080096 (Magma) %o A080096 m:=120; %o A080096 A080096:=[n le 3 select Floor((n+1)/2) else Abs(Self(n-1) - Self(n-2) - Self(n-3)): n in [1..m+5]]; %o A080096 [A080096[n]: n in [1..m]]; // _G. C. Greubel_, Sep 11 2024 %o A080096 (SageMath) %o A080096 @CachedFunction %o A080096 def a(n): # a = A080096 %o A080096 if n<4: return int((n+1)//2) %o A080096 else: return abs(a(n-1)-a(n-2)-a(n-3)) %o A080096 [a(n) for n in range(1,101)] # _G. C. Greubel_, Sep 11 2024 %Y A080096 Cf. A028347, A028557, A077623, A077653, A079623, A079624, A088226. %K A080096 nonn %O A080096 1,3 %A A080096 _Benoit Cloitre_, Jan 28 2003