OFFSET
0,5
MAPLE
with(linalg):rev:=proc(a) local n, p; n:=vectdim(a): p:=i->a[n+1-i]: vector(n, p) end: ps:=proc(a) local n, q; n:=vectdim(a): q:=i->sum(a[j], j=1..i): vector(n, q) end: pss:=proc(a) local n, q; n:=vectdim(a): q:=proc(i) if i<=n then sum(a[j], j=1..i) else sum(a[j], j=1..n) fi end: vector(n+1, q) end: R[0]:=vector(1, 1): for n from 1 to 35 do if n mod 3 = 0 or n mod 3 = 1 then R[n]:=ps(rev(R[n-1])) else R[n]:=pss(rev(R[n-1])) fi od: seq(R[n][1], n=0..35); # Emeric Deutsch, Nov 16 2004
MATHEMATICA
r[n_] := r[n] = If[n == 0, {1}, Module[{a}, Join[a = Accumulate[Reverse[r[n-1]]], If[Mod[n, 3] == 2, {Last[a]}, {}]]]];
a[n_] := If[n == 0, 1, r[n][[1]]];
Table[a[n], {n, 0, 28}] (* Jean-François Alcover, Mar 10 2023 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 13 2004
EXTENSIONS
More terms from Emeric Deutsch, Nov 16 2004
STATUS
approved