cp's OEIS Frontend

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.

A088226 a(1)=0, a(2)=0, a(3)=1; for n>3, a(n) = abs(a(n-1) - a(n-2) - a(n-3)).

This page as a plain text file.
%I A088226 #30 Sep 11 2024 10:07:30
%S A088226 0,0,1,1,0,2,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,
%T A088226 1,5,0,6,1,5,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,
%U A088226 2,6,3,5,4,4,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
%N A088226 a(1)=0, a(2)=0, a(3)=1; for n>3, a(n) = abs(a(n-1) - a(n-2) - a(n-3)).
%C A088226 Conjecture: a(n) = m/2 where m is the smallest even distance from n to a square. - _Ralf Stephan_, Sep 23 2013
%H A088226 Reinhard Zumkeller, <a href="/A088226/b088226.txt">Table of n, a(n) for n = 1..10000</a>
%F A088226 a(k^2 + 2*m + 2) = k-m and a(k^2 + 2*m + 1) = m, for k >= 0 and 0 <= m <= k.
%t A088226 RecurrenceTable[{a[1]==a[2]==0,a[3]==1,a[n]==Abs[a[n-1]-a[n-2]-a[n-3]]},a,{n,110}] (* _Harvey P. Dale_, Apr 13 2012 *)
%o A088226 (PARI) a(n)=t=sqrtint(n);if((n-t*t)%2==0,(n-t*t)/2,((t+1)^2-n)/2) \\ _Ralf Stephan_, Sep 23 2013
%o A088226 (Haskell)
%o A088226 a088226 n = a088226_list !! (n-1)
%o A088226 a088226_list = 0 : 0 : 1 : zipWith3 (\u v w -> abs (w - v - u))
%o A088226                a088226_list (tail a088226_list) (drop 2 a088226_list)
%o A088226 -- _Reinhard Zumkeller_, Oct 11 2014
%o A088226 (Magma)
%o A088226 m:=120;
%o A088226 A088226:=[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 A088226 [A088226[n]: n in [1..m]]; // _G. C. Greubel_, Sep 11 2024
%o A088226 (SageMath)
%o A088226 @CachedFunction
%o A088226 def a(n): # a = A088226
%o A088226     if n<4: return int((n-1)//2)
%o A088226     else: return abs(a(n-1)-a(n-2)-a(n-3))
%o A088226 [a(n) for n in range(1,101)] # _G. C. Greubel_, Sep 11 2024
%Y A088226 Cf. A077623, A077653, A079623, A079624, A080096.
%K A088226 nonn
%O A088226 1,6
%A A088226 _Benoit Cloitre_, Nov 04 2003