OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..20000
MAPLE
b:= proc() 0 end:
g:= proc(n) option remember; local t;
t:= `if`(n<2, n, b(g(n-1))+b(g(n-2)));
b(t):= b(t)+1; t
end:
f:= proc() local t, a; t, a:= -1, proc() -1 end;
proc(n) local h;
while a(n) = -1 do
t:= t+1; h:= g(t);
if a(h) = -1 then a(h):= t fi
od; a(n)
end
end():
a:= proc(n) option remember; `if`(n<0, 0,
max(a(n-1), f(n)))
end:
seq(a(n), n=0..100);
MATHEMATICA
b[_] = 0;
g[n_] := g[n] = Module[{t}, t = If[n < 2, n, b[g[n - 1]] + b[g[n - 2]]]; b[t] = b[t] + 1; t];
f[n_] := Module[{t, a}, t = -1; a[_] = -1; Module[{h}, While[a[n] == -1, t = t + 1; h = g[t]; If[a[h] == -1, a[h] = t]]; a[n]]];
a[n_] := a[n] = If[n < 0, 0, Max[a[n - 1], f[n]]];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 13 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Dec 15 2019
STATUS
approved