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.

A178963 E.g.f.: (3+2*sqrt(3)*exp(x/2)*sin(sqrt(3)*x/2))/(exp(-x)+2*exp(x/2)*cos(sqrt(3)*x/2)).

Original entry on oeis.org

1, 1, 1, 1, 3, 9, 19, 99, 477, 1513, 11259, 74601, 315523, 3052323, 25740261, 136085041, 1620265923, 16591655817, 105261234643, 1488257158851, 17929265150637, 132705221399353, 2172534146099019, 30098784753112329, 254604707462013571, 4736552519729393091, 74180579084559895221, 705927677520644167681, 14708695606607601165843, 256937013876000351610089, 2716778010767155313771539
Offset: 0

Views

Author

N. J. A. Sloane, Dec 31 2010

Keywords

Comments

According to Mendes and Remmel, p. 56, this is the e.g.f. for 3-alternating permutations.

Crossrefs

Number of m-alternating permutations: A000012 (m=1), A000111 (m=2), A178963 (m=3), A178964 (m=4), A181936 (m=5).
Cf. A249402, A249583 (alternative definitions of 3-alternating permutations).

Programs

  • Maple
    A178963_list := proc(dim) local E,DIM,n,k;
    DIM := dim-1; E := array(0..DIM, 0..DIM); E[0,0] := 1;
    for n from 1 to DIM do
    if n mod 3 = 0 then E[n,0] := 0 ;
       for k from n-1 by -1 to 0 do E[k,n-k] := E[k+1,n-k-1] + E[k,n-k-1] od;
    else E[0,n] := 0;
       for k from 1 by 1 to n do E[k,n-k] := E[k-1,n-k+1] + E[k-1,n-k] od;
    fi od; [E[0,0],seq(E[k,0]+E[0,k],k=1..DIM)] end:
    A178963_list(30);  # Peter Luschny, Apr 02 2012
    # Alternatively, using a bivariate exponential generating function:
    A178963 := proc(n) local g, p, q;
    g := (x,z) -> 3*exp(x*z)/(exp(z)+2*exp(-z/2)*cos(z*sqrt(3)/2));
    p := (n,x) -> n!*coeff(series(g(x,z),z,n+2),z,n);
    q := (n,m) -> if modp(n,m) = 0 then 0 else 1 fi:
    (-1)^floor(n/3)*p(n,q(n,3)) end:
    seq(A178963(i),i=0..30); # Peter Luschny, Jun 06 2012
    # third Maple program:
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
         `if`(t=0, add(b(u-j, o+j-1, irem(t+1, 3)), j=1..u),
                   add(b(u+j-1, o-j, irem(t+1, 3)), j=1..o)))
        end:
    a:= n-> b(n, 0, 0):
    seq(a(n), n=0..35);  # Alois P. Heinz, Oct 29 2014
  • Mathematica
    max = 30; f[x_] := (E^x*(2*Sqrt[3]*E^(x/2)*Sin[(Sqrt[3]*x)/2] + 3))/(2*E^((3*x)/2)*Cos[(Sqrt[3]*x)/2] + 1); CoefficientList[Series[f[x], {x, 0, max}], x]*Range[0, max]! // Simplify (* Jean-François Alcover, Sep 16 2013 *)
  • Sage
    # uses[A from A181936]
    A178963 = lambda n: (-1)^int(is_odd(n//3))*A(3,n)
    print([A178963(n) for n in (0..30)]) # Peter Luschny, Jan 24 2017

Formula

a(3*n) = A002115(n). - Peter Luschny, Aug 02 2012