OFFSET
0,3
REFERENCES
Higham, Jeff and Tanny, Stephen, A tamely chaotic meta-Fibonacci sequence. Twenty-third Manitoba Conference on Numerical Mathematics and Computing (Winnipeg, MB, 1993). Congr. Numer. 99 (1994), 67-94.
LINKS
MAPLE
a:=proc(n) option remember;
if n = 0 then -1
elif n = 1 then -1
elif n = 2 then 2
else
if (a(n-1) <= n-1) and (a(n-2) <= n-2) then
a(n-1-a(n-1))+a(n-2-a(n-2));
else lprint("died with n =", n); return (-1);
fi;
fi; end;
[seq(a(n), n=0..100)];
MATHEMATICA
a[n_] := a[n] = Switch[n, 0, -1, 1, -1, 2, 2, _,
If[a[n-1] <= n-1 && a[n-2] <= n-2,
a[n-1-a[n-1]] + a[n-2-a[n-2]],
Print["died with n =", n]; Return[-1]]];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 02 2024 *)
PROG
(Haskell)
a240807 n = a240807_list !! n
a240807_list = -1 : -1 : 2 : zipWith (+) xs (tail xs)
where xs = map a240807 $ zipWith (-) [1..] $ tail a240807_list
-- Reinhard Zumkeller, Apr 17 2014
CROSSREFS
KEYWORD
sign
AUTHOR
N. J. A. Sloane, Apr 15 2014
STATUS
approved