OFFSET
0,5
COMMENTS
...
LINKS
Reinhard Zumkeller, Rows n = 0..500 of triangle, flattened
EXAMPLE
Triangle begins
1;
1, 1;
1, 2,
2, 3, 3;
3, 6, 8,
8, 14, 17,
17, 31, 39, 39;
39, 78, 109, 126,
126, 235, 313, 352,
352, 665, 900, 1026,
1026, 1926, 2591, 2943, 2943;
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: tr:={seq(n*(n+1)/2, n=1..30)}: R[0]:=vector(1, 1): for n from 1 to 15 do if member(n, tr)=false then R[n]:=ps(rev(R[n-1])) else R[n]:=pss(rev(R[n-1])) fi od: for n from 0 to 15 do evalm(R[n]) od; # Emeric Deutsch, Nov 16 2004
MATHEMATICA
triQ[n_] := Reduce[ n == k(k+1)/2, k, Integers] =!= False; row[0] = {1}; row[1] = {1, 1}; row[n_] := row[n] = (ro = Accumulate[ Reverse[ row[n-1]]]; If[triQ[n], Append[ ro, Last[ro] ], ro]); Flatten[ Table[ row[n], {n, 0, 13}]](* Jean-François Alcover, Nov 24 2011 *)
PROG
(Haskell)
a099964 n k = a099964_tabf !! n !! k
a099964_row n = a099964_tabf !! n
a099964_tabf = scanl f [1] $ tail a010054_list where
f row t = if t == 1 then row' ++ [last row'] else row'
where row' = scanl1 (+) $ reverse row
-- Reinhard Zumkeller, May 02 2012
CROSSREFS
KEYWORD
nonn,tabf,nice,easy
AUTHOR
N. J. A. Sloane, Nov 13 2004
EXTENSIONS
More terms from Emeric Deutsch, Nov 16 2004
STATUS
approved