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.

Showing 1-5 of 5 results.

A250261 Number A(n,k) of permutations p of [n] such that p(i) > p(i+1) iff i = 1 + k*m for some m >= 0; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 2, 1, 4, 1, 1, 1, 2, 5, 1, 5, 1, 1, 1, 2, 3, 16, 1, 6, 1, 1, 1, 2, 3, 11, 61, 1, 7, 1, 1, 1, 2, 3, 4, 40, 272, 1, 8, 1, 1, 1, 2, 3, 4, 19, 99, 1385, 1, 9, 1, 1, 1, 2, 3, 4, 5, 78, 589, 7936, 1, 10, 1, 1, 1, 2, 3, 4, 5, 29, 217, 3194, 50521, 1, 11
Offset: 0

Views

Author

Alois P. Heinz, Nov 15 2014

Keywords

Comments

A(n,0) = A(n,k) for k>=n-1 and n>0.

Examples

			Square array A(n,k) begins:
  1, 1,    1,   1,   1,   1,  1, 1, 1, ...
  1, 1,    1,   1,   1,   1,  1, 1, 1, ...
  1, 1,    1,   1,   1,   1,  1, 1, 1, ...
  2, 1,    2,   2,   2,   2,  2, 2, 2, ...
  3, 1,    5,   3,   3,   3,  3, 3, 3, ...
  4, 1,   16,  11,   4,   4,  4, 4, 4, ...
  5, 1,   61,  40,  19,   5,  5, 5, 5, ...
  6, 1,  272,  99,  78,  29,  6, 6, 6, ...
  7, 1, 1385, 589, 217, 133, 41, 7, 7, ...
		

Crossrefs

A(n+3,n+1) = A028387(n).

Programs

  • Maple
    b:= proc(u, o, t, k) option remember; `if`(u+o=0, 1,
         `if`(t=1, add(b(u-j, o+j-1, irem(t+1, k), k), j=1..u),
                   add(b(u+j-1, o-j, irem(t+1, k), k), j=1..o)))
        end:
    A:= (n, k)-> b(0, n, 0, `if`(k=0, n, k)):
    seq(seq(A(n, d-n), n=0..d), d=0..14);
  • Mathematica
    b[u_, o_, t_, k_] := b[u, o, t, k] = If[u+o == 0, 1, If[t == 1, Sum[ b[u-j, o+j-1, Mod[t+1, k], k], {j, 1, u}], Sum[ b[u+j-1, o-j, Mod[t+1, k], k], {j, 1, o}] ] ] ; A[n_, k_] := b[0, n, 0, If[k == 0, n, k]]; Table[Table[A[n, d-n], {n, 0, d}], {d, 0, 14}] // Flatten (* Jean-François Alcover, Feb 03 2015, after Alois P. Heinz *)

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

A249583 Number of permutations p of [n] such that p(i) > p(i+1) iff i == 2 (mod 3).

Original entry on oeis.org

1, 1, 1, 2, 5, 9, 40, 169, 477, 3194, 19241, 74601, 666160, 5216485, 25740261, 287316122, 2769073949, 16591655817, 222237912664, 2543467934449, 17929265150637, 280180369563194, 3712914075133121, 30098784753112329, 537546603651987424, 8094884285992309261
Offset: 0

Views

Author

Alois P. Heinz, Nov 01 2014

Keywords

Comments

This is the (UDU)* version of 3-alternating permutations of [n], (U=Up, D=Down).

Examples

			a(2) = 1: 12.
a(3) = 2: 132, 231.
a(4) = 5: 1324, 1423, 2314, 2413, 3412.
a(5) = 9: 13245, 14235, 15234, 23145, 24135, 25134, 34125, 35124, 45123.
a(6) = 40: 132465, 132564, 142365, 142563, 143562, 152364, 152463, 153462, 162354, 162453, 163452, 231465, 231564, 241365, 241563, 243561, 251364, 251463, 253461, 261354, 261453, 263451, 341265, 341562, 342561, 351264, 351462, 352461, 361254, 361452, 362451, 451263, 451362, 452361, 461253, 461352, 462351, 561243, 561342, 562341.
a(7) = 169: 1324657, 1324756, 1325647, ..., 6723514, 6724513, 6734512.
		

Crossrefs

Cf. A178963 (i=0), A249402 (i=1).

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
         `if`(t=2, 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(0, n, 0):
    seq(a(n), n=0..35);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, If[t == 2, Sum[b[u - j, o + j - 1, Mod[t+1, 3]], {j, 1, u}], Sum[b[u + j - 1, o - j, Mod[t+1, 3]], {j, 1, o}]]];
    a[n_] := b[0, n, 0];
    Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Nov 06 2017, after Alois P. Heinz *)

A250259 The number of 4-alternating permutations of [n].

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 19, 78, 217, 496, 3961, 25442, 105963, 349504, 3908059, 34227438, 190065457, 819786496, 11785687921, 130746521282, 907546301523, 4835447317504, 84965187064099, 1141012634368398, 9504085749177097, 60283564499562496, 1251854782837499881
Offset: 0

Views

Author

R. J. Mathar, Nov 15 2014

Keywords

Comments

A sequence a(1),a(2),... is called k-alternating if a(i) > a(i+1) iff i=1 (mod k).

Crossrefs

Cf. A249402 (3-alternating), A065619 (2-alternating), A250260 (5-alternating).
Column k=4 of A250261.

Programs

  • Maple
    onestep := proc(n::integer,ups::integer,downs::integer,uplen::integer)
        local thisstep,left,doup,tak,ret ;
        option remember;
        left := ups+downs ;
        if left = 0 then
            return 1;
        end if;
        thisstep := n-left+1 ;
        if modp(thisstep-2,uplen+1) = 0 then
            doup := false;
        else
            doup := true;
        end if;
        if doup then
            ret := 0 ;
            for tak from 1 to ups do
                ret := ret+procname(n,ups-tak,downs+tak-1,uplen) ;
            end do:
            return ret ;
        else
            ret := 0 ;
            for tak from 1 to downs do
                ret := ret+procname(n,ups+tak-1,downs-tak,uplen) ;
            end do:
            return ret ;
        end if;
    end proc:
    downupP := proc(n::integer,uplen::integer)
        local ret,tak;
        if n = 0 then
            return 1;
        end if;
        ret := 0 ;
        for tak from 1 to n do
            ret := ret+onestep(n,n-tak,tak-1,uplen) ;
        end do:
        return ret ;
    end proc:
    A250259 :=proc(n)
        downupP(n,3) ;
    end proc:
    seq(A250259(n),n=0..20) ; # R. J. Mathar, Nov 15 2014
    # second Maple program:
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
         `if`(t=1, add(b(u-j, o+j-1, irem(t+1, 4)), j=1..u),
                   add(b(u+j-1, o-j, irem(t+1, 4)), j=1..o)))
        end:
    a:= n-> b(0, n, 0):
    seq(a(n), n=0..35);  # Alois P. Heinz, Nov 15 2014
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, If[t == 1, Sum[b[u - j, o + j - 1, Mod[t + 1, 4]], {j, 1, u}], Sum[b[u + j - 1, o - j, Mod[t + 1, 4]], {j, 1, o}]]]; a[n_] := b[0, n, 0]; Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Jul 10 2017, after Alois P. Heinz *)

A250260 The number of 5-alternating permutations of [n].

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 5, 29, 133, 412, 1041, 2300, 22991, 170832, 822198, 3114489, 10006375, 141705439, 1457872978, 9522474417, 48094772656, 202808749375, 3716808948931, 48860589990687, 403131250565618, 2545098156762649, 13287626090593750
Offset: 0

Views

Author

R. J. Mathar, Nov 15 2014

Keywords

Comments

A sequence a(1), a(2),... is called k-alternating if a(i) > a(i+1) iff i=1 (mod k).

Crossrefs

Cf. A065619 (2-alternating), A249402 (3-alternating), A250259 (4-alternating).
Column k=5 of A250261.

Programs

  • Maple
    # dowupP defined in A250259.
    A250260 :=proc(n)
        downupP(n,4) ;
    end proc:
    seq(A250260(n),n=0..20) ;
    # second Maple program:
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1,
         `if`(t=1, add(b(u-j, o+j-1, irem(t+1, 5)), j=1..u),
                   add(b(u+j-1, o-j, irem(t+1, 5)), j=1..o)))
        end:
    a:= n-> b(0, n, 0):
    seq(a(n), n=0..35);  # Alois P. Heinz, Nov 15 2014
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u+o == 0, 1, If[t == 1, Sum[b[u-j, o+j-1, Mod[t+1, 5]], {j, 1, u}], Sum[b[u+j-1, o-j, Mod[t+1, 5]], {j, 1, o}]]]; a[n_] := b[0, n, 0]; Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Jun 24 2015, after Alois P. Heinz *)
Showing 1-5 of 5 results.