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.
%I A048004 #117 Apr 07 2020 11:37:22 %S A048004 1,1,1,1,2,1,1,4,2,1,1,7,5,2,1,1,12,11,5,2,1,1,20,23,12,5,2,1,1,33,47, %T A048004 27,12,5,2,1,1,54,94,59,28,12,5,2,1,1,88,185,127,63,28,12,5,2,1,1,143, %U A048004 360,269,139,64,28,12,5,2,1,1,232,694,563,303,143,64,28,12,5,2,1,1,376,1328,1167,653,315,144,64,28,12,5,2,1 %N A048004 Triangular array read by rows: T(n,k) = number of binary vectors of length n whose longest run of consecutive 1's has length k, for n >= 0, 0 <= k <= n. %C A048004 Equivalently, number of compositions of n+1 having largest part (exactly) k+1. Example: T(4,2)=5 because we have 3+2, 2+3, 3+1+1, 1+3+1 and 1+1+3. - _Emeric Deutsch_, Apr 01 2005 %C A048004 Here is a bijection between the binary words and the compositions: prefix the vector with a 0, place a comma before each 0, then read the lengths of the runs. Example: 1100 -> 01100 -> ,011,0,0 -> 311 -> 3+1+1. - _N. J. A. Sloane_, Apr 03 2011 %C A048004 A formula based on the conjugates of the partitions of n with largest part k is given as a Sage program below. Note that it gives the compositions in the natural enumeration 'n with largest part k'. The 'conjugate' formula leads to A097805. - _Peter Luschny_, Jul 13 2015 %D A048004 J. Kappraff, Beyond Measure, World Scientific, 2002; see pp. 471-472. %D A048004 J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 155. %H A048004 Alois P. Heinz, <a href="/A048004/b048004.txt">Rows n = 0..140, flattened</a> %H A048004 Richard Southern, <a href="/A048004/a048004.py.txt">Python program</a> %H A048004 J. L. Yucas, <a href="/A006980/a006980.pdf">Counting special sets of binary Lyndon words</a>, Ars Combin., 31 (1991), 21-29. (Annotated scanned copy) %F A048004 T(n, k) = 0 if k < 0 or k > n, 1 if k = 0 or k = n, 2T(n-1, k) + T(n-1, k-1) - 2T(n-2, k-1) + T(n-k-1, k-1) - T(n-k-2, k) otherwise. - _David W. Wilson_ %F A048004 T(n, k) = A048887(n+1, k+1) - A048887(n+1, k). - _Henry Bottomley_, Oct 29 2002 %F A048004 G.f. for column k: (1-x)^2*x^k/((1-2*x+x^(k+1))*(1-2*x+x^(k+2))). - _Emeric Deutsch_, Apr 01 2005 %F A048004 From _Gary W. Adamson_, Jun 23 2012: (Start) %F A048004 Create an array of rows such that row 0 is the INVERT transform of (1,0,0,0,...); row 1 is the INVERT transform of (1,1,0,0,0,...); row 2 is the INVERT transform of (1,1,1,0,0,0,...) and so on: %F A048004 1, 1, 1, 1, 1, 1, ... %F A048004 1, 2, 3, 5, 8, 13, ... %F A048004 1, 2, 4, 7, 13, 24, ... %F A048004 1, 2, 4, 8, 15, 29, ... %F A048004 ... Then, take finite differences of column terms from the top -> down. Row terms of the triangle are finite differences of the array columns. (End) %F A048004 T(n,k) = A126198(n+1,k+1) - A126198(n+1,k). - _L. Edson Jeffery_, May 21 2013 %F A048004 Recurrence: T(n+1,k) = Sum_{h=0..k} T(n-k, h) + Sum_{i=n-k+1..n} T(i, k); for example, T(7,3) = Sum_{h=0..3} T(3,h) + Sum_{i=4..6} T(i,3) or T(7,3) = (1+4+2+1) + (2+5+12) = 27. Example: T(4,2) = (1+1) + (1+2) = 5. - _Richard Southern_, Jul 09 2017 %F A048004 Difference between higher order Fibonacci numbers is equal to recurrence. T(n+1,k) = A126198 (n+1,k) - A126198 (n+1,k-1) = Sum_{i=n-k..n} A126198 (i,k) - Sum_{i=n-k+1..n} A126198 (i,k-1) = A126198 (n-k,k) + Sum_{i=n-k+1..n} (A126198 (i,k) - A126198 (i,k-1)) = Sum_{h=0..k} T(n-k, h) + Sum_{i=n-k+1..n} T(i, k). For example T(7,3) = A126198 (7,3) - A126198 (7,2) = 108 - 81 = (8+15+29+56) - (13+24+44) = 8 + (15-13) + (29-24) + (56-44) = 8 + (2+5+12) = (1+4+2+1) + (2+5+12). - _Richard Southern_, Aug 04 2017 %e A048004 Triangle begins: %e A048004 1; %e A048004 1, 1; %e A048004 1, 2, 1; %e A048004 1, 4, 2, 1; %e A048004 1, 7, 5, 2, 1; %e A048004 1, 12, 11, 5, 2, 1; %e A048004 1, 20, 23, 12, 5, 2, 1; %e A048004 1, 33, 47, 27, 12, 5, 2, 1; %e A048004 1, 54, 94, 59, 28, 12, 5, 2, 1; %e A048004 1, 88, 185, 127, 63, 28, 12, 5, 2, 1; %e A048004 ... %e A048004 Example: T(4,2) = 5 because we have 1100, 1101, 0110, 0011, 1011. %p A048004 G:=k->(1-x)^2*x^k/(1-2*x+x^(k+1))/(1-2*x+x^(k+2)): for k from 0 to 14 do g[k]:=series(G(k),x=0,15) od: 1,seq(seq(coeff(g[k],x^n),k=0..n),n=1..12); # _Emeric Deutsch_, Apr 01 2005 %p A048004 # second Maple program: %p A048004 B:= proc(n, k) option remember; `if`(n=0 or k=1, 1, %p A048004 add (B(n-j, k), j=1..min(n, k))) %p A048004 end: %p A048004 T:= (n, k)-> B(n+1, k+1)-B(n+1, k): %p A048004 seq(seq(T(n, k), k=0..n), n=0..14); # _Alois P. Heinz_, May 21 2013 %t A048004 nn=10;f[list_]:=Select[list,#>0&];Map[f,Transpose[Table[ CoefficientList[ Series[(1-x^k)/(1-2x+x^(k+1))-(1-x^(k-1))/ (1-2x+x^k),{x,0,nn}],x],{k,1,nn}]]]//Grid (* _Geoffrey Critzer_, Jan 13 2013 *) %t A048004 B[n_, k_] := B[n, k] = If[n==0 || k==1, 1, Sum[B[n-j, k], {j, 1, Min[n, k]} ]]; T[n_, k_] := B[n+1, k+1] - B[n+1, k]; Table[T[n, k], {n, 0, 14}, {k, 0, n}] // Flatten (* _Jean-François Alcover_, Dec 01 2015, after _Alois P. Heinz_ *) %o A048004 (Sage) %o A048004 # Computes the triangle obtained by augmenting T(n,k) by appending the column %o A048004 # 1,0,0,0,... on the left. Illustrates a basic partition formula, is not %o A048004 # efficient as a program for large n. %o A048004 def A048004_row(n): %o A048004 r = [] %o A048004 for k in (0..n): %o A048004 s = 0 %o A048004 for p in Partitions(n, max_part=k, inner=[k]): %o A048004 q = p.conjugate() %o A048004 s += mul(binomial(q[j],q[j+1]) for j in range(len(q)-1)) %o A048004 r.append(s) %o A048004 return r %o A048004 [A048004_row(n) for n in (0..9)] # _Peter Luschny_, Jul 13 2015 %o A048004 (Python) # See Richard Southern link. %o A048004 (Haskell) %o A048004 tri n k | (k < 0) || (k > n) = 0 %o A048004 | (k == 0) || (k == n) = 1 %o A048004 | otherwise = 2*tri (n-1) k + tri (n-1) (k-1) - 2*tri (n-2) (k-1) %o A048004 + tri (n-k-1) (k-1) - tri (n-k-2) k %o A048004 -- _Valentin Hübner_, Jul 20 2017, after _David W. Wilson_ %Y A048004 See A126198 and A048887 for closely related arrays. %Y A048004 T(n,2) = Fibonacci(n+2) - 1, A000071, T(n,3) = b(n) for n=3, 4, ..., where b=A000100, T(n,4) = c(n) for n = 4, 5, ..., where c=A000102. %Y A048004 Nonnegative elements of columns approach A045623. %Y A048004 Cf. A048003, A097805. %K A048004 nonn,tabl,nice %O A048004 0,5 %A A048004 _Clark Kimberling_ %E A048004 More terms from _Emeric Deutsch_, Apr 01 2005 %E A048004 Edited by _N. J. A. Sloane_, Apr 03 2011