OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
EXAMPLE
a(2) = |1-0| = 1, a(3) = 1+1 = 2, a(4) = |1-1| = 0, a(5) = 1+2 = 3.
MAPLE
a:= proc(n) option remember;
if n<2 then n
elif irem (n, 2)=0 then abs(a(n/2)-a(n/2-1))
else a((n-1)/2)+a((n-1)/2+1)
fi
end:
seq (a(n), n=0..119);
MATHEMATICA
a[n_] := a[n] = If[n<2, n, If[EvenQ[n], Abs[a[n/2] - a[n/2-1]], a[(n-1)/2] + a[(n-1)/2 + 1]]];
a /@ Range[0, 119] (* Jean-François Alcover, Nov 17 2020 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Aaron K. Johnson (akj(AT)21stcentury.net), Mar 06 2002
EXTENSIONS
Edited by Alois P. Heinz, Feb 04 2011
STATUS
approved