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-2 of 2 results.

A361648 Number of permutations p of [n] such that p(i), p(i+2), p(i+4),... form an up-down sequence for i in {1,2}.

Original entry on oeis.org

1, 1, 2, 3, 6, 20, 80, 350, 1750, 10080, 64512, 450912, 3438204, 28471872, 253913088, 2424193200, 24687555750, 267199961600, 3062092267520, 37037541651968, 471565937953396, 6304419553216512, 88298062293762048, 1292879475255280640, 19753693667117055100
Offset: 0

Views

Author

Alois P. Heinz, Mar 19 2023

Keywords

Comments

Number of permutations p of [n] such that p(i) < p(i+2) > p(i+4) < ... for i <= 2.

Examples

			a(0) = 1: (), the empty permutation.
a(1) = 1: 1.
a(2) = 2: 12, 21.
a(3) = 3: 123, 132, 213.
a(4) = 6: 1234, 1243, 1324, 2134, 2143, 3142.
a(5) = 20: 12453, 12534, 12543, 13452, 13542, 14352, 21453, 21534, 21543, 23451, 23541, 24351, 31452, 31524, 31542, 32451, 32541, 41523, 41532, 42531.
a(6) = 80: 124635, 125634, 125643, 126453, ..., 526413, 526431, 536412, 536421.
		

Crossrefs

Column k=2 of A361651.

Programs

  • Maple
    b:= proc(u, o) option remember; `if`(u+o=0, 1,
          add(b(o-1+j, u-j), j=1..u))
        end:
    a:= n-> (h-> b(h, 0)*b(n-h, 0)*binomial(n, h))(iquo(n, 2)):
    seq(a(n), n=0..30);
  • Mathematica
    b[u_, o_] := b[u, o] = If[u+o == 0, 1, Sum[b[o-1+j, u-j], {j, 1, u}]];
    a[n_] := With[{h = Quotient[n, 2]}, b[h, 0] b[n-h, 0] Binomial[n, h]];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Nov 26 2023, after Alois P. Heinz *)
  • Python
    from math import comb
    from itertools import accumulate
    def A361648(n):
        if n<=1:
            return 1
        blist = (0,1)
        for _ in range((m:=n>>1)-1):
            blist = tuple(accumulate(reversed(blist),initial=0))
        return blist[-1]*sum(blist)*comb(n,m) if n&1 else blist[-1]**2*comb(n,m) # Chai Wah Wu, Apr 16 2023

Formula

a(n) = A000111(floor(n/2))*A000111(ceiling(n/2))*A001405(n).

A367336 Number of permutations p of [n] such that p(i), p(i+3), p(i+6),... form an up-down sequence for i in {1,2,3}.

Original entry on oeis.org

1, 1, 2, 6, 12, 30, 90, 420, 2240, 13440, 84000, 577500, 4331250, 36036000, 322882560, 3099672576, 31513337856, 340409701632, 3893435962416, 47122428697344, 600341948743680, 8030803773358080, 112453396587417600, 1646232972560748000, 25147419121286426250
Offset: 0

Views

Author

Alois P. Heinz, Nov 14 2023

Keywords

Comments

Number of permutations p of [n] such that p(i) < p(i+3) > p(i+6) < ... for i <= 3.

Examples

			a(4) = 12: 1234, 1243, 1324, 1342, 1423, 1432, 2134, 2143, 2314, 2413, 3124, 3214.
a(5) = 30: 12345, 12354, 12435, 12453, 12534, 12543, 13245, 13254, 13425, 13524, 14235, 14325, 21345, 21354, 21435, 21453, 21534, 21543, 23145, 23154, 24135, 31245, 31254, 31452, 31542, 32145, 32154, 41253, 41352, 42153.
		

Crossrefs

Column k=3 of A361651.

Programs

  • Maple
    b:= proc(u, o) option remember;
         `if`(u+o=0, 1, add(b(o-1+j, u-j), j=1..u))
        end:
    a:= n-> (l-> combinat[multinomial](n, l[])*mul(
            b(s, 0), s=l))([floor((n+i)/3)$i=0..2]):
    seq(a(n), n=0..27);
  • Mathematica
    multinomial[n_, k_List] := n!/Times @@ (k!);
    b[u_, o_] := b[u, o] = If[u+o == 0, 1, Sum[b[o-1+j, u-j], {j, 1, u}]];
    a[n_] := Function[l, Product[b[s, 0], {s, l}]*multinomial[n, l]][Table[ Floor[(n+i)/3], {i, 0, 2}]];
    Table[a[n], {n, 0, 27}] (* Jean-François Alcover, Nov 27 2023, after Alois P. Heinz *)
Showing 1-2 of 2 results.