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

A105927 Let d(n) = A000166(n); then a(n) = ( (n^2+n-1)*d(n) + (-1)^(n-1)*(n-1) )/2.

Original entry on oeis.org

0, 0, 2, 12, 84, 640, 5430, 50988, 526568, 5940576, 72755370, 961839340, 13656650172, 207316760352, 3351430059614, 57487448630220, 1042952206111440, 19954639072648768, 401578933206288978, 8480263630552747596, 187505565234912994340, 4332318322289242716480
Offset: 0

Views

Author

N. J. A. Sloane, Apr 27 2005

Keywords

Comments

Wang, Miska, & Mező call these 2-derangement numbers.
Number of permutations p of [n] such that p(k) = k+2 for exactly two k in the range 0Vladeta Jovovic, Dec 14 2007
Number of derangements of the multiset {0,0,1,2,...,n}. For example a(3)=12 because we have: {1,2,0,3,0}, {1,2,3,0,0}, {1,3,0,0,2}, {1,3,2,0,0}, {2,1,0,3,0}, {2,1,3,0,0}, {2,3,0,0,1}, {2,3,0,1,0}, {3,1,0,0,2}, {3,1,2,0,0}, {3,2,0,0,1}, {3,2,0,1,0}. - Geoffrey Critzer, Jun 02 2014
Number of derangements of a set of n + 2 elements such that the first two elements belong to distinct cycles. - Istvan Mezo, Apr 05 2017

References

  • P. A. MacMahon, Combinatory Analysis, 2 vols., Chelsea, NY, 1960, see p. 108.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, n*(n-1),
           n*(n-1)*(a(n-1)+a(n-2))/(n-2))
        end:
    seq(a(n), n=0..25);  # Alois P. Heinz, Jun 03 2014
  • Mathematica
    Table[(Subfactorial[n+2]-2Subfactorial[n+1]-Subfactorial[n])/2,{n,0,21}] (* Geoffrey Critzer, Jun 02 2014 *)
  • PARI
    s(n) = if( n<1, 1, n * s(n-1) + (-1)^n);
    a(n) = (s(n + 2) - 2*s(n + 1) - s(n))/2; \\ Indranil Ghosh, Apr 06 2017

Formula

a(n) = n*(n-1)*(a(n-1) + a(n-2))/(n-2) for n >= 3, a(n) = n*(n-1) for n < 3. - Alois P. Heinz, Jun 03 2014
a(n) ~ sqrt(Pi/2) * n^(n+5/2) / exp(n+1). - Vaclav Kotesovec, Sep 05 2014
a(n) = (n^2 + n + 1) * n!/e + O(1). - Charles R Greathouse IV, Apr 07 2017

A161129 Triangle read by rows: T(n,k) is the number of non-derangements of {1,2,...,n} for which the difference between the largest and smallest fixed points is k (n>=1; 0 <= k <= n-1).

Original entry on oeis.org

1, 0, 1, 3, 0, 1, 8, 3, 2, 2, 45, 8, 9, 8, 6, 264, 45, 44, 42, 36, 24, 1855, 264, 265, 256, 234, 192, 120, 14832, 1855, 1854, 1810, 1704, 1512, 1200, 720, 133497, 14832, 14833, 14568, 13950, 12864, 11160, 8640, 5040, 1334960, 133497, 133496, 131642, 127404
Offset: 1

Views

Author

Emeric Deutsch, Jul 18 2009

Keywords

Comments

Row sums give the number of non-derangement permutations of {1,2,...,n} (A002467).
T(n,0) = A000240(n) = number of permutations of {1,2,...,n} with exactly 1 fixed point.
T(n,1) = A000240(n-1).
T(n,2) = A000166(n-1) (the derangement numbers).
T(n,3) = A018934(n-1).
Sum_{k=0..n-1} k*T(n,k) = A161130(n).

Examples

			T(4,1)=3 because we have 1243, 4231, and 2134; T(4,2)=2 because we have 1432 and 3214; T(5,4)=6 because we have 1xyz5 where xyz is any permutation of 234.
Triangle starts:
    1;
    0,  1;
    3,  0,  1;
    8,  3,  0,  1;
   45,  8,  9,  8,  6;
  264, 45, 44, 42, 36, 24;
		

Crossrefs

Programs

  • Maple
    d[0] := 1: for n to 15 do d[n] := n*d[n-1]+(-1)^n end do: T := proc (n, k) if k = 0 then n*d[n-1] elif k < n then (n-k)*(sum(binomial(k-1, j)*d[n-2-j], j = 0 .. k-1)) else 0 end if end proc: for n to 10 do seq(T(n, k), k = 0 .. n-1) end do; # yields sequence in triangular form
  • Mathematica
    d = Subfactorial;
    T[n_, 0] := n*d[n - 1];
    T[n_, k_] := (n - k)*Sum[d[n - j - 2]*Binomial[k - 1, j], {j, 0, k - 1}];
    Table[T[n, k], {n, 1, 10}, {k, 0, n - 1}] // Flatten (* Jean-François Alcover, Nov 28 2017 *)

Formula

T(n,0) = n*d(n-1); T(n,k) = (n-k)*Sum_{j=0..k-1}d(n-2-j)*binomial(k-1,j) for 1 <= k <= n-1, where d(i)=A000166(i) are the derangement numbers.

A193364 Number of permutations that have a fixed point and contain 123.

Original entry on oeis.org

0, 0, 0, 1, 1, 3, 11, 59, 369, 2665, 21823, 199983, 2028701, 22577141, 273551115, 3585133147, 50540288857, 762641865009, 12265883397719, 209475278413895, 3785852926650453, 72191462591370733, 1448516763956727331, 30507960955933725171, 672958104387944656145
Offset: 0

Views

Author

Jon Perry, Dec 20 2012

Keywords

Comments

A000142(n-2) gives number of permutations with a 123 present.
It appears that a(n) = A180191(n-2) - A018934(n-3) for n>3.

Examples

			For n=5 we have 12345, 12354 and 41235, so a(5)=3.
For n=6 we have 123456, 123465, 123546, 123465, 123645, 123654, 412356, 451236, 512346, 541236 and 612354, so a(6)=11.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n<7, [0$3, 1$2, 3, 11][n+1],
           ((4*n^3-42*n^2+92*n+39) *a(n-1)
            +(32*n^3-2*n^4-163*n^2+223*n+204) *a(n-2)
            -(n-4)*(n-7)*(2*n^2-10*n-15) *a(n-3)) / (2*n^2-14*n-3))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Jan 07 2013
  • Mathematica
    a[n_] := a[n] = If[n<7, {0, 0, 0, 1, 1, 3, 11}[[n+1]], ((4n^3 - 42n^2 + 92n + 39) a[n-1] + (32n^3 - 2n^4 - 163n^2 + 223n + 204) a[n-2] - (n-4)(n-7) (2n^2 - 10n - 15) a[n-3])/(2n^2 - 14n - 3)];
    a /@ Range[0, 30] (* Jean-François Alcover, Mar 15 2021, after Alois P. Heinz *)

A373966 Triangle read by rows: T(n,k) = (-1)^(n+1) * A000166(n) + (-1)^(k) * A000166(k) for n >= 2 and 1 <= k <= n-1.

Original entry on oeis.org

-1, 2, 3, -9, -8, -11, 44, 45, 42, 53, -265, -264, -267, -256, -309, 1854, 1855, 1852, 1863, 1810, 2119, -14833, -14832, -14835, -14824, -14877, -14568, -16687, 133496, 133497, 133494, 133505, 133452, 133761, 131642, 148329, -1334961, -1334960, -1334963, -1334952, -1335005, -1334696, -1336815, -1320128, -1468457
Offset: 2

Views

Author

Mohammed Yaseen, Jun 24 2024

Keywords

Examples

			Triangle begins:
    -1;
     2,    3;
    -9,   -8,  -11;
    44,   45,   42,   53;
  -265, -264, -267, -256, -309;
  1854, 1855, 1852, 1863, 1810, 2119;
  ...
		

Crossrefs

Unsigned columns: A000166, A000240.
Unsigned diagonals: A000255, A018934.

Programs

  • Mathematica
    T[n_,k_]:= (-1)^(n+1)*Subfactorial[n] + (-1)^k*Subfactorial[k]; Table[T[n,k],{n,2,10},{k,n-1}]// Flatten (* Stefano Spezia, Jun 24 2024 *)

Formula

Integral_{1..e} (log(x)^k - log(x)^n) dx = T(n,k)*e + A373967(n,k).
Showing 1-4 of 4 results.