We have a recurrence which produces a triangle's row and would like to find an efficient way to produce all rows up to that limit. In addition: Is there a way to do this using matrices? Where we would define a seed number and the same rules to get a triangle?
Clear[a, n];
a[0] := {1};
a[1] := {2*a[0], 3*a[0]};
a[n_] := Flatten[{{4*a[n - 2][[1]], 6*a[n - 2], 9*a[n - 2][[-1]]}}]
Edit corrected the row skipping.
a[-1] = {};
a[0] = {1};
a[n_] := a[n] = Flatten[{{2*a[n - 1][[1]], 6*a[n - 2], 3*a[n - 1][[-1]]}}]
NestList[]
, of course:NestList[{#[[2]], Flatten[{4 #[[1, 1]], 6 #[[1]], 9 #[[1, -1]]}]} &, {{1}, {2, 3}}, 5]
. $\endgroup$b[n_, j_] := 2^(n - j)*3^j
so could do e.g.Table[b[n, j], {n, 0, 10}, {j, 0, n}]
. $\endgroup$