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.

A026386 Triangular array T read by rows: T(n,0) = T(n,n) = 1 for all n >= 0; T(n,k) = T(n-1,k-1) + T(n-1,k) for even n and k = 1..n-1; T(n,k) = T(n-1,k-1) + T(n-1,k) + T(n-2,k-1) for odd n and k = 1 ..n-1.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 4, 4, 1, 1, 5, 8, 5, 1, 1, 7, 17, 17, 7, 1, 1, 8, 24, 34, 24, 8, 1, 1, 10, 39, 75, 75, 39, 10, 1, 1, 11, 49, 114, 150, 114, 49, 11, 1, 1, 13, 70, 202, 339, 339, 202, 70, 13, 1, 1, 14, 83, 272, 541, 678, 541, 272, 83, 14, 1, 1, 16
Offset: 0

Views

Author

Keywords

Comments

T(n, k) = number of integer strings s(0)..s(n) such that s(0) = 0, s(n) = n - 2k, where, for u = 1..n, s(i) is odd if i is odd and |s(i)-s(i-1)| <=1.

Examples

			Rows n=0 through n=7:
  1
  1 ... 1
  1 ... 2 ... 1
  1 ... 4 ... 4 ... 1
  1 ... 5 ... 8 ... 5 ... 1
  1 ... 7 ... 17 .. 17 .. 7 ... 1
  1 ... 8 ... 24 .. 34 .. 24 .. 8 ... 1
  1 ... 10 .. 39 .. 75 .. 75 .. 39 .. 10 ... 1
		

Crossrefs

Cf. A007318.

Programs

  • Maple
    A026386 := proc(n,k)
        option remember;
        if k=0 or k = n then
            1;
        elif k <0 or k > n then
            0 ;
        elif type(n,'even') then
            procname(n-1,k-1)+procname(n-1,k) ;
        else
            procname(n-1,k-1)+procname(n-1,k)+procname(n-2,k-1) ;
        end if;
    end proc: # R. J. Mathar, Feb 10 2015
  • Mathematica
    z = 12; t[n_, 0] := 1; t[n_, n_] := 1; t[n_, k_] := t[n, k] =
    Which[EvenQ[n], t[n - 1, k - 1] + t[n - 1, k], OddQ[n], t[n - 1, k - 1] +
    t[n - 1, k] + t[n - 2, k - 1]]; u = Table[t[n, k], {n, 0, z}, {k, 0, n}];
    TableForm[u] (* A026386 array *)
    Flatten[u]   (* A026386 sequence *)
  • PARI
    T(n)={[Vecrev(p) | p<-Vec((1 + (1 + y)*x - y*x^2)/(1 - (1 + 3*y + y^2)*x^2) + O(x*x^n))]}
    { my(A=T(10)); for(i=1, #A, print(A[i])) } \\ Andrew Howroyd, Dec 27 2024

Formula

G.f.: (1 + (1 + y)*x - y*x^2)/(1 - (1 + 3*y + y^2)*x^2). - Andrew Howroyd, Dec 27 2024

Extensions

Updated by Clark Kimberling, Aug 28 2014
Offset corrected by R. J. Mathar, Feb 10 2015