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

A001565 3rd differences of factorial numbers.

Original entry on oeis.org

2, 11, 64, 426, 3216, 27240, 256320, 2656080, 30078720, 369774720, 4906137600, 69894316800, 1064341555200, 17255074636800, 296754903244800, 5396772116736000, 103484118786048000, 2086818140639232000, 44150769074700288000, 977904962186600448000
Offset: 0

Views

Author

Keywords

Comments

From Emeric Deutsch, Sep 09 2010: (Start)
a(n) is the number of isolated entries in all permutations of [n+2]. An entry j of a permutation p is isolated if it is not preceded by j-1 and not followed by j+1. For example, the permutation 23178564 has 2 isolated entries: 1 and 4. a(1)=11 because in 123, 1'3'2', 2'1'3', 231', 3'12, and 3'2'1' we have a total of 11 isolated entries (they are marked).
a(n) = Sum_{k>=0} k*A180196(n+2,k). (End)

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A047920.
Cf. A180196.

Programs

  • GAP
    List([0..20], n-> (n^3+3*n^2+5*n+2)*Factorial(n)); # G. C. Greubel, Apr 29 2019
  • Magma
    [(n^3+3*n^2+5*n+2)*Factorial(n): n in [0..20]]; // G. C. Greubel, Apr 29 2019
    
  • Mathematica
    Table[(n^3 +3*n^2 +5*n +2) n!, {n, 0, 20}] (* T. D. Noe, Aug 09 2012 *)
    Differences[Range[0, 25]!, 3] (* Paolo Xausa, May 28 2025 *)
  • PARI
    {a(n) = (n^3+3*n^2+5*n+2)*n!}; \\ G. C. Greubel, Apr 29 2019
    
  • Sage
    [(n^3+3*n^2+5*n+2)*factorial(n) for n in (0..20)] # G. C. Greubel, Apr 29 2019
    

Formula

a(n) = (n^3 + 3*n^2 + 5*n + 2)*n!. - Mitch Harris, Jul 10 2008
E.g.f.: (2 + 3*x + x^3)/(1 - x)^4. - Ilya Gutkovskiy, Jan 20 2017

A180564 Number of permutations of [n] having no isolated entries. An entry j of a permutation p is isolated if it is not preceded by j-1 and not followed by j+1. For example, the permutation 23178564 has 2 isolated entries: 1 and 4.

Original entry on oeis.org

1, 0, 1, 1, 2, 3, 7, 14, 35, 81, 216, 557, 1583, 4444, 13389, 40313, 128110, 409519, 1366479, 4603338, 16064047, 56708713, 206238116, 759535545, 2870002519, 10986716984, 43019064953, 170663829777, 690840124506, 2832976091771, 11831091960887, 50040503185030
Offset: 0

Views

Author

Emeric Deutsch, Sep 09 2010

Keywords

Comments

a(n) = A180196(n,0).
a(n) = n! - A184181(n).

Examples

			a(5)=3 because we have 12345, 34512, and 45123.
		

Crossrefs

Programs

  • Maple
    d[ -1] := 0: d[0] := 1: for n to 50 do d[n] := n*d[n-1]+(-1)^n end do: a := proc (n) options operator, arrow: sum(binomial(n-j-1, j-1)*(d[j]+d[j-1]), j = 1 .. floor((1/2)*n)) end proc:a(0):=1: seq(a(n), n = 0 .. 32);
    # second Maple program:
    a:= proc(n) option remember; `if`(n<4, [1, 0, 1, 1][n+1],
          (3*a(n-1)+(n-3)*a(n-2)-(n-3)*a(n-3)+(n-4)*a(n-4))/2)
        end:
    seq(a(n), n=0..31);  # Alois P. Heinz, Feb 17 2024
  • Mathematica
    a[n_] := If[n == 0, 1, With[{d = Subfactorial}, Sum[Binomial[n-j-1, j-1]* (d[j] + d[j-1]), {j, 1, Floor[n/2]}]]];
    Table[a[n], {n, 0, 31}] (* Jean-François Alcover, Sep 17 2024 *)

Formula

a(n) = Sum_{j=1..floor(n/2)} binomial(n-j-1, j-1)*(d(j) + d(j-1)), where d(i) = A000166(i) are the derangement numbers; a(0)=1.

Extensions

a(0)=1 prepended by Alois P. Heinz, Feb 17 2024

A184183 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k blocks of length 2 (0 <= k <= floor(n/2)). A block of a permutation is a maximal sequence of consecutive integers which appear in consecutive positions. For example, the permutation 5412367 has 4 blocks: 5, 4, 123, and 67; one of them is of length 2.

Original entry on oeis.org

1, 1, 1, 1, 4, 2, 14, 9, 1, 65, 46, 9, 366, 285, 66, 3, 2451, 2006, 539, 44, 18949, 16054, 4776, 530, 11, 166033, 144128, 46230, 6224, 265, 1624948, 1436322, 487573, 75269, 4635, 53, 17561350, 15740718, 5584332, 954116, 74430, 1854, 207650171, 188194591, 69157935, 12776470, 1177625, 44499, 309
Offset: 0

Views

Author

Emeric Deutsch, Feb 14 2011

Keywords

Comments

Number of entries in row n is 1+floor(n/2).
Sum of entries in row n is n!.
T(2n+1,n) = d(n+2), where d(i)=A000166(n) are the derangement numbers.
T(2n,n) = d(n-1) + d(n), where d(i)=A000166(n) are the derangement numbers.
Sum_{k>=0} k*T(n,k) = A001565(n-3) (n>=3).

Examples

			T(4,1) = 9 because we have 1243, 2314, 3421, 3124, 4231, 1342, 4312, 1423, and 2134.
T(6,3) = 3 because we have 563412, 341256, and 125634.
Triangle starts:
    1;
    1;
    1,   1;
    4,   2;
   14,   9,  1;
   65,  46,  9;
  366, 285, 66, 3;
  ...
		

Crossrefs

Programs

  • Maple
    d[-1] := 0: d[0] := 1: for n to 40 do d[n] := n*d[n-1]+(-1)^n end do: b := proc (n, i, j) if i+2*j < n then add(binomial(n+i-2*q-1, q-i-j-1)*factorial(q)*(d[q]+d[q-1])/(factorial(i)*factorial(j)*factorial(q-i-j)), q = i+j+1 .. (1/3)*n+(2/3)*i+(1/3)*j) elif i+2*j = n then factorial(i+j)*(d[i+j]+d[i+j-1])/(factorial(i)*factorial(j)) else 0 end if end proc: T := proc (n, k) options operator, arrow; add(b(n, i, k), i = 0 .. n) end proc: for n from 0 to 12 do seq(T(n, k), k = 0 .. floor((1/2)*n)) end do; # yields sequence in triangular form
  • Mathematica
    d = Subfactorial;
    b[n_, i_, j_] := Which[i+2j < n, Sum[Binomial[n+i-2q-1, q-i-j-1]*q!*(d[q]+ d[q-1])/(i!*j!*(q-i-j)!), {q, i+j+1, n/3 + 2i/3 + j/3}], i+2j == n, (i+j)!*((d[i+j] + d[i+j-1])/(i!*j!)), True, 0];
    T[n_, k_] := Sum[b[n, i, k], {i, 0, n}]; T[0, 0] = 1;
    Table[T[n, k], {n, 0, 12}, {k, 0, Quotient[n, 2]}] // Flatten (* Jean-François Alcover, Feb 16 2021, after Maple *)

Formula

T(n,k) = Sum_{i=0..n} b(n,i,k), where b(n,i,j) = number of permutations of {1,2,...,n} having i blocks of length 1 and j blocks of length 2 is given by
b(n,i,j) = Sum_{q=i+j+1..(1/3)*(n+2i+j)} binomial(n+i-2q-1, q-i-j-1)*q!*(d(q) + d(q-1))/(i!j!(q-i-j)!) if i+2j < n,
b(n,i,j) = binomial(i+j,i)*(d(q) + d(q-1)) if i+2j=n,
b(n,i,j) = 0 if i+2j > n, where
d(m) = A000166(m) are the derangement numbers.
Showing 1-3 of 3 results.