OFFSET
1,3
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
MATHEMATICA
nxt[{a_, b_, c_}]:={b, c, Abs[c-b-a]}; NestList[nxt, {1, 1, 2}, 110][[All, 1]] (* Harvey P. Dale, Nov 14 2021 *)
PROG
(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))
(Haskell)
a080096 n = a080096_list !! (n-1)
a080096_list = 1 : 1 : 2 : zipWith3 (\u v w -> abs (w - v - u))
a080096_list (tail a080096_list) (drop 2 a080096_list)
-- Reinhard Zumkeller, Oct 11 2014
(Magma)
m:=120;
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]];
[A080096[n]: n in [1..m]]; // G. C. Greubel, Sep 11 2024
(SageMath)
@CachedFunction
def a(n): # a = A080096
if n<4: return int((n+1)//2)
else: return abs(a(n-1)-a(n-2)-a(n-3))
[a(n) for n in range(1, 101)] # G. C. Greubel, Sep 11 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Jan 28 2003
STATUS
approved