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-10 of 544 results. Next

A082491 a(n) = n! * d(n), where n! = factorial numbers (A000142), d(n) = subfactorial numbers (A000166).

Original entry on oeis.org

1, 0, 2, 12, 216, 5280, 190800, 9344160, 598066560, 48443028480, 4844306476800, 586161043776000, 84407190782745600, 14264815236056985600, 2795903786354347468800, 629078351928420506112000, 161044058093696572354560000, 46541732789077953723039744000
Offset: 0

Views

Author

Emanuele Munarini, Apr 28 2003

Keywords

Comments

a(n) is also the number of pairs of n-permutations p and q such that p(x)<>q(x) for each x in { 1, 2, ..., n }.
Or number of n X n matrices with exactly one 1 and one 2 in each row and column, other entries 0 (cf. A001499). - Vladimir Shevelev, Mar 22 2010
a(n) is approximately equal to (n!)^2/e. - J. M. Bergot, Jun 09 2018

Crossrefs

Programs

  • Maple
    with (combstruct):a:=proc(m) [ZL, {ZL=Set(Cycle(Z, card>=m))}, labeled]; end: ZLL:=a(2):seq(count(ZLL, size=n)*n!, n=0..15); # Zerinvary Lajos, Jun 11 2008
  • Mathematica
    Table[Subfactorial[n]*n!, {n, 0, 15}] (* Zerinvary Lajos, Jul 10 2009 *)
  • Maxima
    A000166[0]:1$
    A000166[n]:=n*A000166[n-1]+(-1)^n$
      makelist(n!*A000166[n], n, 0, 12); /* Emanuele Munarini, Mar 01 2011 */
    
  • PARI
    d(n)=if(n<1, n==0, n*d(n-1)+(-1)^n);
    a(n)=d(n)*n!;
    vector(33,n,a(n-1))
    /* Joerg Arndt, May 28 2012 */
    
  • PARI
    {a(n) = if( n<2, n==0, n! * round(n! / exp(1)))}; /* Michael Somos, Jun 24 2018 */
    
  • Python
    A082491_list, m, x = [], 1, 1
    for n in range(10*2):
        x, m = x*n**2 + m, -(n+1)*m
        A082491_list.append(x) # Chai Wah Wu, Nov 03 2014
    
  • Scala
    val A082491_pairs: LazyList[BigInt && BigInt] =
      (BigInt(0), BigInt(1)) #::
      (BigInt(1), BigInt(0)) #::
      lift2 {
        case ((n, z), (_, y)) =>
          (n+2, (n+2)*(n+1)*((n+1)*z+y))
      } (A082491_pairs, A082491_pairs.tail)
    val A082491: LazyList[BigInt] =
      lift1(_._2)(A082491_pairs)
    /** Luc Duponcheel, Jan 25 2020 */

Formula

a(n) = n! * d(n) where d(n) = A000166(n).
a(n) = Sum_{k=0..n} binomial(n, k)^2 * (-1)^k * (n - k)!^2 * k!.
a(n+2) = (n+2)*(n+1) * ( a(n+1) + (n+1)*a(n) ).
a(n) ~ 2*Pi*n^(2*n+1)*exp(-2*n-1). - Ilya Gutkovskiy, Dec 04 2016

A101559 This table (read by rows) shows the coefficients of sum formulas of n-th subfactorial numbers (A000166). The n-th row (n>=1) contains T(i,n) for i=1 to n, where T(i,n) satisfies Subf(n) = Sum_{i=1..n} T(i,n) * n^(n-i).

Original entry on oeis.org

1, 1, -2, 1, -4, 4, 1, -7, 15, -10, 1, -11, 42, -65, 34, 1, -16, 96, -267, 339, -154, 1, -22, 191, -831, 1891, -2103, 874, 1, -29, 344, -2151, 7600, -15023, 15171, -5914, 1, -37, 575, -4880, 24600, -74884, 133147, -124755, 46234, 1, -46, 907, -10025, 68153, -293925, 798564, -1305847, 1151331, -409114, 1, -56
Offset: 1

Views

Author

André F. Labossière, Dec 06 2004

Keywords

Examples

			Subf(9) = [ 9^8 -37*9^7 +575*9^6 -4880*9^5 +24600*9^4 -74884*9^3 +133147*9^2 - 124755*9 +46234 ] = 14833.
		

Crossrefs

A334715 A(n,k) = !n + [n > 0] * (k * n!), where !n = A000166(n) is subfactorial of n and [] is an Iverson bracket; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 1, 2, 3, 2, 1, 3, 5, 8, 9, 1, 4, 7, 14, 33, 44, 1, 5, 9, 20, 57, 164, 265, 1, 6, 11, 26, 81, 284, 985, 1854, 1, 7, 13, 32, 105, 404, 1705, 6894, 14833, 1, 8, 15, 38, 129, 524, 2425, 11934, 55153, 133496, 1, 9, 17, 44, 153, 644, 3145, 16974, 95473, 496376, 1334961
Offset: 0

Views

Author

Alois P. Heinz, May 08 2020

Keywords

Examples

			Square array A(n,k) begins:
     1,    1,     1,     1,     1,     1,     1,     1, ...
     0,    1,     2,     3,     4,     5,     6,     7, ...
     1,    3,     5,     7,     9,    11,    13,    15, ...
     2,    8,    14,    20,    26,    32,    38,    44, ...
     9,   33,    57,    81,   105,   129,   153,   177, ...
    44,  164,   284,   404,   524,   644,   764,   884, ...
   265,  985,  1705,  2425,  3145,  3865,  4585,  5305, ...
  1854, 6894, 11934, 16974, 22014, 27054, 32094, 37134, ...
  ...
		

Crossrefs

Columns k=0-3 give: A000166, A001120, A110043, A110149.
Rows n=0-3 give: A000012, A001477, A005408, A016933.
Main diagonal gives A334716.
Cf. A000142.

Programs

  • Maple
    A:= proc(n, k) option remember; `if`(n<2,
          (k-1)*n+1, n*A(n-1, k)+(-1)^n)
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    A[n_, k_] := Subfactorial[n] + Boole[n>0] k n!;
    Table[A[n, d-n], {d, 0, 10}, {n, 0, d}] // Flatten (* Jean-François Alcover, Feb 11 2021 *)

Formula

E.g.f. of column k: (k*exp(x)*x+1)*exp(-x)/(1-x).
A(n,k) = A000166(n) + [n > 0] * (k * n!).
A(n,k) = (k-1)*n + 1 if n<2, A(n,k) = n*A(n-1, k) + (-1)^n if n>=2.

A378157 The least prime dividing !n = A000166(n).

Original entry on oeis.org

2, 3, 2, 5, 2, 7, 2, 3, 2, 11, 2, 13, 2, 3, 2, 17, 2, 11, 2, 3, 2, 23, 2, 5, 2, 3, 2, 29, 2, 31, 2, 3, 2, 5, 2, 11, 2, 3, 2, 11, 2, 43, 2, 3, 2, 47, 2, 7, 2, 3, 2, 53, 2, 5, 2, 3, 2, 11, 2, 61, 2, 3, 2, 5, 2, 67, 2, 3, 2, 71, 2, 73, 2, 3, 2, 7, 2, 79, 2, 3, 2
Offset: 3

Views

Author

Amiram Eldar, Nov 18 2024

Keywords

Crossrefs

Programs

  • Mathematica
    lpf[n_] := Module[{p = 2}, While[! Divisible[n, p], p = NextPrime[p]]; p]; Array[lpf[Subfactorial[#]] &, 50, 3]
  • PARI
    lpf(n) = {my(p = 2); while(n % p, p = nextprime(p+1)); p;}
    lista(nmax) = {my(s = 1); for(n = 3, nmax, s = n * s + (-1)^n; print1(lpf(s), ", ")); }

Formula

a(n) = A020639(A000166(n)).
a(n) = min(A020639(n-1), A378159(n-2)) for n >= 2.

A065087 a(n) = A000166(n)*binomial(n+1,2).

Original entry on oeis.org

0, 0, 3, 12, 90, 660, 5565, 51912, 533988, 6007320, 73422855, 969181620, 13744757598, 208462156812, 3367465610145, 57727981888080, 1046800738237320, 20020064118788592, 402756584036805963, 8502638996332570140, 187953072550509445410, 4341715975916768188740
Offset: 0

Views

Author

N. J. A. Sloane, Nov 10 2001

Keywords

Comments

a(n) is also the number of permutations of [2n-1] having n-1 isolated fixed points (i.e. adjacent entries are not fixed points). Example: a(2)=3 because we have 132, 213, and 321. - Emeric Deutsch, Apr 18 2009

Crossrefs

Equals 3 * A000313(n+2).

Programs

  • Mathematica
    a[n_] := Subfactorial[n]*Binomial[n + 1, 2];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Aug 18 2024 *)

Formula

a(n) = (n/2)*A000240(n+1). - Zerinvary Lajos, Dec 18 2007, corrected Jul 09 2012
a(n) = n * (n+1) * (a(n-1)/(n-1) + (-1)^n/2) for n > 1 - Seiichi Manyama, Jun 24 2018
E.g.f.: exp(-x)*x^2*(3 - 2*x + x^2)/(2*(1 - x)^3). - Ilya Gutkovskiy, Jun 25 2018

A173184 Partial sums of A000166.

Original entry on oeis.org

1, 1, 2, 4, 13, 57, 322, 2176, 17009, 150505, 1485466, 16170036, 192384877, 2483177809, 34554278858, 515620794592, 8212685046337, 139062777326001, 2494364438359954, 47245095998005060, 942259727190907181, 19737566982241851721, 433234326593362631602
Offset: 0

Views

Author

Jonathan Vos Post, Feb 12 2010

Keywords

Comments

Partial sums of subfactorial or rencontres numbers, or derangements (number of permutations of n elements with no fixed points). The subsequence of primes begins: 2, 13, 192384877.

Examples

			a(3) = 1 + 0 + 1 + 2 = 4.
		

Crossrefs

Programs

  • Mathematica
    a[0] = 1; a[n_] := a[n] = n*a[n - 1] + (-1)^n; Accumulate@ Array[a, 21, 0] (* Robert G. Wilson v, Apr 01 2011 *)
    dr[{n_,a1_,a2_}]:={n+1,a2,n(a1+a2)}; Accumulate[Transpose[NestList[dr,{0,0,1},30]][[3]]] (* Harvey P. Dale, Jul 17 2014 *)
    Table[Sum[Subfactorial[k], {k, 0, n}], {n, 0, 100}] (* Emanuele Munarini, Aug 24 2017 *)
  • Maxima
    s[0]:1$
    s[n]:=n*s[n-1]+(-1)^n$
    makelist(sum(s[k],k,0,n),n,0,12); /* Emanuele Munarini, Aug 24 2017 */

Formula

G.f.: 1/U(0)/(1-x) where U(k) = 1 + x - x*(k+1)/(1 - x*(k+1)/U(k+1)); (continued fraction). - Sergei N. Gladkovskii, Oct 15 2012
G.f.: 1/(1 - x^2) + (1/(1 - x))*Sum_{k>=1} k^k*x^k/(1 + (k + 1)*x)^(k+1). - Ilya Gutkovskiy, Apr 13 2017
From Emanuele Munarini, Oct 06 2017: (Start)
E.g.f.: exp(-t)/(1-t) - exp(t-2)*(coshIntegral(2-2*t) + sinhIntegral(2-2*t) - expIntegralEi(2)).
a(n+2) - (n+3)*a(n+1) + (n+2)*a(n) = (-1)^n. (End)
D-finite with recurrence a(n+3) - (n+3)*a(n+2) + (n+2)*a(n) = 0. - Emanuele Munarini, Aug 24 2017

A159610 Triangle read by rows, n-th row = n terms of A000255: (1, 3, 11, 53, 309, ...); right border = A000166 starting (1, 2, 9, 44, 265, ...).

Original entry on oeis.org

1, 3, 2, 11, 11, 9, 53, 53, 53, 44, 309, 309, 309, 309, 265, 2119, 2119, 2119, 2119, 2119, 1854, 16687, 16687, 16687, 16687, 16687, 14833, 148329, 148329, 148329, 148329, 148329, 148329, 148329, 133496
Offset: 0

Views

Author

Gary W. Adamson, Apr 17 2009

Keywords

Comments

Row sums = A002469(n+2), representing the game of mousetrap with n cards; where nonzero terms of A002469 start: (1, 5, 31, 203, 1501, ...). A002469(n) = (n-2)*A000255(n-1) + A000166(n). Example 31 = 2*11 + 9 = A002469(4) = 2*A000255(3) + A000166(4).

Examples

			First few rows of the triangle:
      1;
      3,     2;
     11,    11,     9;
     53,    53,    53,    44;
    309,   309,   309,   309,   265;
   2119,  2119,  2119,  2119,  2119,  1854;
  16687, 16687, 16687, 16687, 16687, 16687, 14833;
  ...
		

Crossrefs

Formula

Triangle read by rows, n-th row = n terms of A000255: (1, 3, 11, 53, 309, ...); right border = A000166 starting (1, 2, 9, 44, 265, ...)

A301423 Numbers k such that !k/(k-1) is prime, where !k = A000166(k) is the subfactorial of k.

Original entry on oeis.org

4, 5, 6, 11, 15, 44, 66, 168, 575, 1713
Offset: 1

Views

Author

Amiram Eldar, Mar 20 2018

Keywords

Comments

Also numbers k such that A000255(k-2) is prime.
The corresponding primes are 3, 11, 53, 1468457, 34361893981, 22742406079421034331584846001936724930824184898296683, ...
a(11) > 35000. - Robert Price, Apr 14 2018

Crossrefs

Programs

  • Mathematica
    Select[Range[2,100], PrimeQ[Subfactorial[#]/(#-1)] &]
  • PARI
    isok(n) = (n != 1) && isprime(n!*sum(k=0, n, (-1)^k/k!)/(n-1)); \\ Michel Marcus, Mar 24 2018

A378160 The number of distinct prime factors of !n = A000166(n).

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 3, 4, 2, 3, 2, 4, 3, 3, 4, 3, 3, 4, 5, 5, 4, 7, 5, 6, 4, 5, 7, 6, 6, 7, 4, 4, 4, 8, 4, 6, 4, 5, 6, 6, 4, 7, 2, 4, 7, 8, 6, 5, 7, 6, 7, 7, 4, 6, 9, 6, 6, 6, 6, 6, 4, 4, 5, 4, 3, 6, 6, 6, 6, 6, 7, 7, 4, 8, 6, 5, 8, 6, 4, 4, 5, 8, 4, 7, 7, 8, 6
Offset: 2

Views

Author

Amiram Eldar, Nov 18 2024

Keywords

Crossrefs

Programs

  • Mathematica
    Array[PrimeNu[Subfactorial[#]] &, 40, 2]
  • PARI
    lista(nmax) = {my(s = 0); for(n = 2, nmax, s = n * s + (-1)^n; print1(omega(s), ", "));}

Formula

a(n) = A001221(A000166(n)).
a(n) >= A001221(n-1) + 1 for n >=5.

Extensions

a(82)-a(88) from Jinyuan Wang, Nov 24 2024

A378161 The number of prime factors of !n = A000166(n), counted with multiplicity.

Original entry on oeis.org

0, 1, 2, 3, 2, 4, 3, 6, 5, 3, 3, 6, 3, 3, 5, 6, 3, 8, 5, 6, 5, 8, 5, 9, 5, 5, 11, 7, 6, 9, 4, 8, 6, 8, 4, 10, 5, 5, 7, 8, 4, 8, 2, 7, 12, 8, 6, 9, 8, 7, 8, 8, 4, 10, 10, 8, 7, 6, 6, 8, 4, 4, 8, 9, 3, 8, 6, 7, 7, 6, 7, 13, 4, 8, 8, 6, 9, 7, 4, 7, 10, 8, 4, 9, 7
Offset: 2

Views

Author

Amiram Eldar, Nov 18 2024

Keywords

Crossrefs

Programs

  • Mathematica
    Array[PrimeOmega[Subfactorial[#]] &, 40, 2]
  • PARI
    lista(nmax) = {my(s = 0); for(n = 2, nmax, s = n * s + (-1)^n; print1(bigomega(s), ", "));}

Formula

a(n) = A001222(A000166(n)).
a(n) >= A001222(n-1) + 1 for n >=4, with equality if and only if n is in A301423.

Extensions

a(82)-a(86) from Jinyuan Wang, Nov 24 2024
Showing 1-10 of 544 results. Next