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.

A229756 Triangle T(n,k): the number of binary sequences of n zeros and n ones in which the longest run is of length k.

Original entry on oeis.org

2, 2, 4, 2, 12, 6, 2, 32, 28, 8, 2, 82, 110, 48, 10, 2, 206, 408, 224, 72, 12, 2, 516, 1454, 968, 378, 100, 14, 2, 1294, 5048, 4016, 1784, 578, 132, 16, 2, 3252, 17244, 16202, 7980, 2924, 830, 168, 18, 2, 8194, 58290, 64058, 34570, 13810, 4464, 1140, 208, 20
Offset: 1

Views

Author

Andrew Woods, Sep 28 2013

Keywords

Comments

Row n sums to C(2n,n) (A000984).

Examples

			The triangle begins:
2
2  4
2 12   6
2 32  28  8
2 82 110 48 10
The second row counts the sets {0101, 1010} and {0011, 0110, 1001, 1100}.
		

Programs

  • PARI
    h(n,p,k)=if(k==0,0,sum(j=0,floor((n-p)/k),(-1)^j*binomial(p,j)*binomial(n-1-j*k,p-1)))
    g(n,k)=2*sum(i=1,n,h(n,i,k)*(h(n,i,k)+h(n,i+1,k)))
    T(n,k)=g(n,k)-g(n,k-1)
    r(n)=vector(n,x,2*T(n,x))

Formula

Let h(n,p,k) := sum(j=0..floor((n-p)/k), (-1)^j*C(p,j)*C(n-1-j*k,p-1)) with h(n,p,0) := 0, and let g(n,k) := 2*sum(i=1..n, h(n,i,k)*(h(n,i,k)+h(n,i+1,k))). Then T(n,k) = g(n,k)-g(n,k-1).