cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A168396 Triangle, T(n,k) = number of compositions a(1),...,a(j) of n with a(1) = k, such that a(i+1) <= a(i) + 1 for 1 <= i < j.

This page as a plain text file.
%I A168396 #14 Sep 19 2013 19:13:57
%S A168396 1,1,1,2,1,1,3,2,1,1,5,4,2,1,1,9,6,4,2,1,1,15,11,7,4,2,1,1,26,19,12,7,
%T A168396 4,2,1,1,45,33,21,13,7,4,2,1,1,78,57,37,22,13,7,4,2,1,1,135,99,64,39,
%U A168396 23,13,7,4,2,1,1,234,172,112,68,40,23,13,7,4,2,1,1,406,298,194,119,70,41,23,13,7,4,2,1,1
%N A168396 Triangle, T(n,k) = number of compositions a(1),...,a(j) of n with a(1) = k, such that a(i+1) <= a(i) + 1 for 1 <= i < j.
%C A168396 The definition is a replica of the recursion formula in A005169: T(n,1) = A005169(n). Row sums, central terms and A003116 coincide: sum(T(n,k): k=1..n) = A003116(n); T(2*n-1,n) = A003116(n-1). - _Reinhard Zumkeller_, Sep 13 2013
%H A168396 Reinhard Zumkeller, <a href="/A168396/b168396.txt">Rows n=1..120 of triangle, flattened</a>
%e A168396 First 16 rows of triangle:
%e A168396 .   1:     1
%e A168396 .   2:     1    1
%e A168396 .   3:     2    1    1
%e A168396 .   4:     3    2    1   1
%e A168396 .   5:     5    4    2   1   1
%e A168396 .   6:     9    6    4   2   1   1
%e A168396 .   7:    15   11    7   4   2   1   1
%e A168396 .   8:    26   19   12   7   4   2   1  1
%e A168396 .   9:    45   33   21  13   7   4   2  1  1
%e A168396 .  10:    78   57   37  22  13   7   4  2  1  1
%e A168396 .  11:   135   99   64  39  23  13   7  4  2  1  1
%e A168396 .  12:   234  172  112  68  40  23  13  7  4  2  1 1
%e A168396 .  13:   406  298  194 119  70  41  23 13  7  4  2 1 1
%e A168396 .  14:   704  518  337 207 123  71  41 23 13  7  4 2 1 1
%e A168396 .  15:  1222  898  586 360 214 125  72 41 23 13  7 4 2 1 1
%e A168396 .  16:  2120 1559 1017 626 373 218 126 72 41 23 13 7 4 2 1 1
%p A168396 b:= proc(n, k) option remember; `if`(n=0, 1,
%p A168396       add(b(n-j, j+1), j=1..min(n, k)))
%p A168396     end:
%p A168396 T:= (n, k)-> b(n-k, k+1):
%p A168396 seq(seq(T(n, k), k=1..n), n=1..14); # _Alois P. Heinz_, Sep 19 2013
%t A168396 t[n_, k_] /; k > n = 0; t[n_, n_] = 1; t[n_, k_] := t[n, k] = Sum[ t[n-k, j], {j, 1, k+1}]; Flatten[ Table[ t[n, k], {n, 1, 13}, {k, 1, n}] ](* _Jean-François Alcover_, Feb 17 2012, after Pari *)
%o A168396 (PARI) T(n,k)=if(k>=n,k==n,sum(j=1,k+1,T(n-k,j)))
%o A168396 (PARI) Tm(n)=local(m);m=matrix(n,n);for(i=1,n,for(j=1,i,m[i,j]=if(i==j,1,sum(k=1,j+1,m[i-j,k]))));m
%o A168396 (Haskell)
%o A168396 a168396 n k = a168396_tabl !! (n-1) !! (k-1)
%o A168396 a168396_row n = a168396_tabl !! (n-1)
%o A168396 a168396_tabl = [1] : f [[1]] where
%o A168396    f xss = ys : f (ys : xss) where
%o A168396      ys = (map sum $ zipWith take [2..] xss) ++ [1] -- _Reinhard Zumkeller_, Sep 13 2013
%Y A168396 Cf. A005169 (first column), A003116 (apparently row sums).
%K A168396 nonn,tabl
%O A168396 1,4
%A A168396 _Franklin T. Adams-Watters_, Nov 24 2009