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.

Previous Showing 11-20 of 131 results. Next

A005046 Number of partitions of a 2n-set into even blocks.

Original entry on oeis.org

1, 1, 4, 31, 379, 6556, 150349, 4373461, 156297964, 6698486371, 337789490599, 19738202807236, 1319703681935929, 99896787342523081, 8484301665702298804, 802221679220975886631, 83877585692383961052499, 9640193854278691671399436, 1211499609050804749310115589
Offset: 0

Views

Author

Keywords

Comments

Conjecture: Taking the sequence modulo an integer k gives an eventually periodic sequence. For example, the sequence taken modulo 10 is [1, 1, 4, 1, 9, 6, 9, 1, 4, 1, 9, 6, 9, 1, 4, 1, 9, 6, 9, ...], with an apparent period [1, 4, 1, 9, 6, 9] beginning at a(1), of length 6. Cf. A006154. - Peter Bala, Apr 12 2023

References

  • Louis Comtet, Analyse Combinatoire Tome II, pages 61-62.
  • Louis Comtet, Advanced Combinatorics, Reidel, 1974, p. 225, 3rd line of table.
  • CRC Standard Mathematical Tables and Formulae, 30th ed. 1996, p. 42.
  • L. B. W. Jolley, Summation of Series. 2nd ed., Dover, NY, 1961, p. 150.
  • L. Lovasz, Combinatorial Problems and Exercises, North-Holland, 1993, pp. 15.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A156289 for the table of partitions of a 2n-set into k even blocks.
For partitions into odd blocks see A003724 and A136630.

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n=0, 1, add(binomial(2*n-1, 2*k-1) *a(n-k), k=1..n))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Apr 12 2011
    # second Maple program:
    a := n -> add(binomial(2*n,k)*(-1)^k*BellB(k,1/2)*BellB(2*n-k,1/2), k=0..2*n):
    seq(a(n), n=0..18); # after Emanuele Munarini,_Peter Luschny_, Sep 10 2017
    B := BellMatrix(n -> modp(n, 2), 31): # defined in A264428.
    seq(add(k, k in B[2*n + 1]),n=0..15); # Peter Luschny, Aug 13 2019
  • Mathematica
    NestList[ Factor[ D[#, {x, 2}]] &, Exp[ Cosh[x] - 1], 16] /. x -> 0
    a[0] = 1; a[n_] := Sum[Sum[(i-k)^(2*n)*Binomial[2*k, i]*(-1)^i, {i, 0, k-1}]/(2^(k-1)*k!), {k, 1, 2*n}]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Apr 07 2015, after Vladimir Kruchinin *)
    Table[Sum[BellY[2 n, k, 1 - Mod[Range[2 n], 2]], {k, 0, 2 n}], {n, 0, 20}] (* Vladimir Reshetnikov, Nov 09 2016 *)
    With[{nn=40},Abs[Take[CoefficientList[Series[Exp[Cos[x]-1],{x,0,nn}],x] Range[0,nn]!,{1,-1,2}]]] (* Harvey P. Dale, Feb 06 2017 *)
  • Maxima
    a(n):= sum(1/k!*sum(binomial(k,m)/(2^(m-1))*sum(binomial(m,j) *(2*j-m)^(2*n), j,0,m/2)*(-1)^(k-m), m,0,k), k,1,2*n); /* Vladimir Kruchinin, Aug 05 2010 */
    
  • Maxima
    a(n):=sum(sum((i-k)^(2*n)*binomial(2*k,i)*(-1)^(i),i,0,k-1)/(2^(k-1)*k!),k,1,2*n); /* Vladimir Kruchinin, Oct 04 2012 */
    
  • Python
    from sympy.core.cache import cacheit
    from sympy import binomial
    @cacheit
    def a(n): return 1 if n==0 else sum(binomial(2*n - 1, 2*k - 1)*a(n - k) for k in range(1, n + 1))
    print([a(n) for n in range(21)]) # Indranil Ghosh, Sep 11 2017, after Maple program by Alois P. Heinz

Formula

E.g.f.: exp(cosh(x) - 1) (or exp(cos(x)-1) ).
a(n) = Sum_{k=1..n} binomial(2*n-1, 2*k-1)*a(n-k). - Vladeta Jovovic, Apr 10 2003
a(n) = sum(1/k!*sum(binomial(k,m)/(2^(m-1))*sum(binomial(m,j)*(2*j-m)^(2*n),j,0,m/2)*(-1)^(k-m),m,0,k),k,1,2*n), n>0. - Vladimir Kruchinin, Aug 05 2010
a(n) = Sum_{k=1..2*n} Sum_{i=0..k-1} ((i-k)^(2*n)*binomial(2*k,i)*(-1)^i)/(2^(k-1)*k!), n>0, a(0)=1. - Vladimir Kruchinin, Oct 04 2012
E.g.f.: E(0)-1, where E(k) = 2 + (cosh(x)-1)/(2*k + 1 - (cosh(x)-1)/E(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Dec 23 2013
a(n) = Sum_{k=0..2*n} binomial(2*n,k)*(-1)^k*S_k(1/2)*S_{2*n-k}( 1/2), where S_n(x) is the n-th Bell polynomial (or exponential polynomial). - Emanuele Munarini, Sep 10 2017

A008299 Triangle T(n,k) of associated Stirling numbers of second kind, n >= 2, 1 <= k <= floor(n/2).

Original entry on oeis.org

1, 1, 1, 3, 1, 10, 1, 25, 15, 1, 56, 105, 1, 119, 490, 105, 1, 246, 1918, 1260, 1, 501, 6825, 9450, 945, 1, 1012, 22935, 56980, 17325, 1, 2035, 74316, 302995, 190575, 10395, 1, 4082, 235092, 1487200, 1636635, 270270, 1, 8177, 731731, 6914908, 12122110
Offset: 2

Views

Author

Keywords

Comments

T(n,k) is the number of set partitions of [n] into k blocks of size at least 2. Compare with A008277 (blocks of size at least 1) and A059022 (blocks of size at least 3). See also A200091. Reading the table by diagonals gives A134991. The row generating polynomials are the Mahler polynomials s_n(-x). See [Roman, 4.9]. - Peter Bala, Dec 04 2011
Row n gives coefficients of moments of Poisson distribution about the mean expressed as polynomials in lambda [Haight]. The coefficients of the moments about the origin are the Stirling numbers of the second kind, A008277. - N. J. A. Sloane, Jan 24 2020
Rows are of lengths 1,1,2,2,3,3,..., a pattern typical of matrices whose diagonals are rows of another lower triangular matrix--in this instance those of A134991. - Tom Copeland, May 01 2017
For a relation to decomposition of spin correlators see Table 2 of the Delfino and Vito paper. - Tom Copeland, Nov 11 2012

Examples

			There are 3 ways of partitioning a set N of cardinality 4 into 2 blocks each of cardinality at least 2, so T(4,2)=3.
Table begins:
  1;
  1;
  1,    3;
  1,   10;
  1,   25,     15;
  1,   56,    105;
  1,  119,    490,     105;
  1,  246,   1918,    1260;
  1,  501,   6825,    9450,      945;
  1, 1012,  22935,   56980,    17325;
  1, 2035,  74316,  302995,   190575,   10395;
  1, 4082, 235092, 1487200,  1636635,  270270;
  1, 8177, 731731, 6914908, 12122110, 4099095, 135135;
  ...
Reading the table by diagonals produces the triangle A134991.
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 222.
  • Frank Avery Haight, "Handbook of the Poisson distribution," John Wiley, 1967. See pages 6,7, but beware of errors. [Haight on page 7 gives five different ways to generate these numbers (see link)].
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 76.
  • S. Roman, The Umbral Calculus, Dover Publications, New York (2005), pp. 129-130.

Crossrefs

Rows: A000247 (k=2), A000478 (k=3), A058844 (k=4).
Row sums: A000296, diagonal: A259877.

Programs

  • Maple
    A008299 := proc(n,k) local i,j,t1; if k<1 or k>floor(n/2) then t1 := 0; else
    t1 := add( (-1)^i*binomial(n, i)*add( (-1)^j*(k - i - j)^(n - i)/(j!*(k - i - j)!), j = 0..k - i), i = 0..k); fi; t1; end; # N. J. A. Sloane, Dec 06 2016
    G:= exp(lambda*(exp(x)-1-x)):
    S:= series(G,x,21):
    seq(seq(coeff(coeff(S,x,n)*n!,lambda,k),k=1..floor(n/2)),n=2..20); # Robert Israel, Jan 15 2020
    T := proc(n, k) option remember; if n < 0 then return 0 fi; if k = 0 then return k^n fi; k*T(n-1, k) + (n-1)*T(n-2, k-1) end:
    seq(seq(T(n,k), k=1..n/2), n=2..9); # Peter Luschny, Feb 11 2021
  • Mathematica
    t[n_, k_] := Sum[ (-1)^i*Binomial[n, i]*Sum[ (-1)^j*(k - i - j)^(n - i)/(j!*(k - i - j)!), {j, 0, k - i}], {i, 0, k}]; Flatten[ Table[ t[n, k], {n, 2, 14}, {k, 1, Floor[n/2]}]] (* Jean-François Alcover, Oct 13 2011, after David Wasserman *)
    Table[Sum[Binomial[n, k - j] StirlingS2[n - k + j, j] (-1)^(j + k), {j, 0, k}], {n, 15}, {k, n/2}] // Flatten (* Eric W. Weisstein, Nov 13 2018 *)
  • PARI
    {T(n, k) = if( n < 1 || 2*k > n, n==0 && k==0, sum(i=0, k, (-1)^i * binomial( n, i) * sum(j=0, k-i, (-1)^j * (k-i-j)^(n-i) / (j! * (k-i-j)!))))}; /* Michael Somos, Oct 19 2014 */
    
  • PARI
    { T(n,k) = sum(i=0,min(n,k), (-1)^i * binomial(n,i) * stirling(n-i,k-i,2) ); } /* Max Alekseyev, Feb 27 2017 */

Formula

T(n,k) = abs(A137375(n,k)).
E.g.f. with additional constant 1: exp(t*(exp(x)-1-x)) = 1 + t*x^2/2! + t*x^3/3! + (t+3*t^2)*x^4/4! + ....
Recurrence relation: T(n+1,k) = k*T(n,k) + n*T(n-1,k-1).
T(n,k) = A134991(n-k,k); A134991(n,k) = T(n+k,k).
More generally, if S_r(n,k) gives the number of set partitions of [n] into k blocks of size at least r then we have the recurrence S_r(n+1,k) = k*S_r(n,k) + binomial(n,r-1)*S_r(n-r+1,k-1) (for this sequence, r=2), with associated e.g.f.: Sum_{n>=0, k>=0} S_r(n,k)*u^k*(t^n/n!) = exp(u*(e^t - Sum_{i=0..r-1} t^i/i!)).
T(n,k) = Sum_{i=0..k} (-1)^i*binomial(n, i)*Sum_{j=0..k-i} (-1)^j*(k-i-j)^(n-i)/(j!*(k-i-j)!). - David Wasserman, Jun 13 2007
G.f.: (R(0)-1)/(x^2*y), where R(k) = 1 - (k+1)*y*x^2/( (k+1)*y*x^2 - (1-k*x)*(1-x-k*x)/R(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Nov 09 2013
T(n,k) = Sum_{i=0..min(n,k)} (-1)^i * binomial(n,i) * Stirling2(n-i,k-i) = Sum_{i=0..min(n,k)} (-1)^i * A007318(n,i) * A008277(n-i,k-i). - Max Alekseyev, Feb 27 2017
T(n, k) = Sum_{j=0..n-k} binomial(j, n-2*k)*E2(n-k, n-k-j) where E2(n, k) are the second-order Eulerian numbers A340556. - Peter Luschny, Feb 11 2021

Extensions

Formula and cross-references from Barbara Haas Margolius (margolius(AT)math.csuohio.edu), Dec 14 2000
Edited by Peter Bala, Dec 04 2011
Edited by N. J. A. Sloane, Jan 24 2020

A056857 Triangle read by rows: T(n,c) = number of successive equalities in set partitions of n.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 5, 6, 3, 1, 15, 20, 12, 4, 1, 52, 75, 50, 20, 5, 1, 203, 312, 225, 100, 30, 6, 1, 877, 1421, 1092, 525, 175, 42, 7, 1, 4140, 7016, 5684, 2912, 1050, 280, 56, 8, 1, 21147, 37260, 31572, 17052, 6552, 1890, 420, 72, 9, 1, 115975, 211470, 186300, 105240, 42630, 13104, 3150, 600, 90, 10, 1
Offset: 1

Views

Author

Winston C. Yang (winston(AT)cs.wisc.edu), Aug 31 2000

Keywords

Comments

Number of successive equalities s_i = s_{i+1} in a set partition {s_1, ..., s_n} of {1, ..., n}, where s_i is the subset containing i, s(1) = 1 and s(i) <= 1 + max of previous s(j)'s.
T(n,c) = number of set partitions of the set {1,2,...,n} in which the size of the block containing the element 1 is k+1. Example: T(4,2)=3 because we have 123|4, 124|3 and 134|2. - Emeric Deutsch, Nov 10 2006
Let P be the lower-triangular Pascal-matrix (A007318), Then this is exp(P) / exp(1). - Gottfried Helms, Mar 30 2007. [This comment was erroneously attached to A011971, but really belongs here. - N. J. A. Sloane, May 02 2015]
From David Pasino (davepasino(AT)yahoo.com), Apr 15 2009: (Start)
As an infinite lower-triangular matrix (with offset 0 rather than 1, so the entries would be B(n - c)*binomial(n, c), B() a Bell number, rather than B(n - 1 - c)*binomial(n - 1, c) as below), this array is S P S^-1 where P is the Pascal matrix A007318, S is the Stirling2 matrix A048993, and S^-1 is the Stirling1 matrix A048994.
Also, S P S^-1 = (1/e)*exp(P). (End)
Exponential Riordan array [exp(exp(x)-1), x]. Equal to A007318*A124323. - Paul Barry, Apr 23 2009
Equal to A049020*A048994 as infinite lower triangular matrices. - Philippe Deléham, Nov 19 2011
Build a superset Q[n] of set partitions of {1,2,...,n} by distinguishing "some" (possibly none or all) of the singletons. Indexed from n >= 0, 0 <= k <= n, T(n,k) is the number of elements in Q[n] that have exactly k distinguished singletons. A singleton is a subset containing one element. T(3,1) = 6 because we have {{1}'{2,3}}, {{1,2}{3}'}, {{1,3}{2}'}, {{1}'{2}{3}}, {{1}{2}'{3}}, {{1}{2}{3}'}. - Geoffrey Critzer, Nov 10 2012
Let Bell(n,x) denote the n-th Bell polynomial, the n-th row polynomial of A048993. Then this is the triangle of connection constants when expressing the basis polynomials Bell(n,x + 1) in terms of the basis polynomials Bell(n,x). For example, row 3 is (5, 6, 3, 1) and 5 + 6*Bell(1,x) + 3*Bell(2,x) + Bell(3,x) = 5 + 6*x + 3*(x + x^2) + (x + 3*x^2 + x^3) = 5 + 10*x + 6*x^2 + x^3 = (x + 1) + 3*(x + 1)^2 + (x + 1)^3 = Bell(3,x + 1). - Peter Bala, Sep 17 2013

Examples

			For example {1, 2, 1, 2, 2, 3} is a set partition of {1, 2, 3, 4, 5, 6} and has 1 successive equality, at i = 4.
Triangle begins:
    1;
    1,   1;
    2,   2,   1;
    5,   6,   3,   1;
   15,  20,  12,   4,   1;
   52,  75,  50,  20,   5,   1;
  203, 312, 225, 100,  30,   6,   1;
  ...
From _Paul Barry_, Apr 23 2009: (Start)
Production matrix is
  1,  1;
  1,  1,  1;
  1,  2,  1,  1;
  1,  3,  3,  1,  1;
  1,  4,  6,  4,  1,  1;
  1,  5, 10, 10,  5,  1,  1;
  1,  6, 15, 20, 15,  6,  1,  1;
  1,  7, 21, 35, 35, 21,  7,  1,  1;
  1,  8, 28, 56, 70, 56, 28,  8,  1,  1; ... (End)
		

References

  • W. C. Yang, Conjectures on some sequences involving set partitions and Bell numbers, preprint, 2000. [Apparently unpublished]

Crossrefs

Cf. Bell numbers A000110 (column c=0), A052889 (c=1), A105479 (c=2), A105480 (c=3).
Cf. A056858-A056863. Essentially same as A056860, where the rows are read from right to left.
Cf. also A007318, A005493, A270953.
See A259691 for another version.
T(2n+1,n+1) gives A124102.
T(2n,n) gives A297926.

Programs

  • Maple
    with(combinat): A056857:=(n,c)->binomial(n-1,c)*bell(n-1-c): for n from 1 to 11 do seq(A056857(n,c),c=0..n-1) od; # yields sequence in triangular form; Emeric Deutsch, Nov 10 2006
    with(linalg): # Yields sequence in matrix form:
    A056857_matrix := n -> subs(exp(1)=1, exponential(exponential(
    matrix(n,n,[seq(seq(`if`(j=k+1,j,0),k=0..n-1),j=0..n-1)])))):
    A056857_matrix(8); # Peter Luschny, Apr 18 2011
  • Mathematica
    t[n_, k_] := BellB[n-1-k]*Binomial[n-1, k]; Flatten[ Table[t[n, k], {n, 1, 11}, {k, 0, n-1}]](* Jean-François Alcover, Apr 25 2012, after Emeric Deutsch *)
  • PARI
    B(n) = sum(k=0, n, stirling(n, k, 2));
    tabl(nn)={for(n=1, nn, for(k=0, n - 1, print1(B(n - 1 - k) * binomial(n - 1, k),", ");); print(););};
    tabl(12); \\ Indranil Ghosh, Mar 19 2017
    
  • Python
    from sympy import bell, binomial
    for n in range(1,12):
        print([bell(n - 1 - k) * binomial(n - 1, k) for k in range(n)]) # Indranil Ghosh, Mar 19 2017
    
  • SageMath
    def a(n): return (-1)^n / factorial(n)
    @cached_function
    def p(n, m):
        R = PolynomialRing(QQ, "x")
        if n == 0: return R(a(m))
        return R((m + x)*p(n - 1, m) - (m + 1)*p(n - 1, m + 1))
    for n in range(11): print(p(n, 0).list())  # Peter Luschny, Jun 18 2023

Formula

T(n,c) = B(n-1-c)*binomial(n-1, c), where T(n,c) is the number of set partitions of {1, ..., n} that have c successive equalities and B() is a Bell number.
E.g.f.: exp(exp(x)+x*y-1). - Vladeta Jovovic, Feb 13 2003
G.f.: 1/(1-xy-x-x^2/(1-xy-2x-2x^2/(1-xy-3x-3x^2/(1-xy-4x-4x^2/(1-... (continued fraction). - Paul Barry, Apr 23 2009
Considered as triangle T(n,k), 0 <= k <= n: T(n,k) = A007318(n,k)*A000110(n-k) and Sum_{k=0..n} T(n,k)*x^k = A000296(n), A000110(n), A000110(n+1), A005493(n), A005494(n), A045379(n) for x = -1, 0, 1, 2, 3, 4 respectively. - Philippe Deléham, Dec 13 2009
Let R(n,x) denote the n-th row polynomial of the triangle. Then A000110(n+j) = Bell(n+j,1) = Sum_{k = 1..n} R(j,k)*Stirling2(n,k) (Spivey). - Peter Bala, Sep 17 2013

Extensions

More terms from David Wasserman, Apr 22 2002

A003436 Number of inequivalent labeled Hamiltonian circuits on n-octahedron. Interlacing chords joining 2n points on circle.

Original entry on oeis.org

1, 0, 1, 4, 31, 293, 3326, 44189, 673471, 11588884, 222304897, 4704612119, 108897613826, 2737023412199, 74236203425281, 2161288643251828, 67228358271588991, 2225173863019549229, 78087247031912850686, 2896042595237791161749, 113184512236563589997407
Offset: 0

Views

Author

Keywords

Comments

Also called the relaxed ménage problem (cf. A000179).
a(n) can be seen as a subset of the unordered pairings of the first 2n integers (A001147) with forbidden pairs (1,2n) and (i,i+1) for all i in [1,2n-1] (all adjacent integers modulo 2n). The linear version of this constraint is A000806. - Olivier Gérard, Feb 08 2011
Number of perfect matchings in the complement of C_{2n} where C_{2n} is the cycle graph on 2n vertices. - Andrew Howroyd, Mar 15 2016
Also the number of 2-uniform set partitions of {1...2n} containing no two cyclically successive vertices in the same block. - Gus Wiseman, Feb 27 2019

References

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

Crossrefs

Cf. A003435, A129348. A003437 gives unlabeled case.
First differences of A000806.
Column k=2 of A324428.

Programs

  • Maple
    A003436 := proc(n) local k;
          if n = 0 then 1
        elif n = 1 then 0
        else add( (-1)^k*binomial(n,k)*2*n/(2*n-k)*2^k*(2*n-k)!/2^n/n!,k=0..n) ;
        end if;
    end proc: # R. J. Mathar, Dec 11 2013
    A003436 := n-> `if`(n<2, 1-n, (-1)^n*2*hypergeom([n, -n], [], 1/2)):
    seq(simplify(A003436(n)), n=0..18); # Peter Luschny, Nov 10 2016
  • Mathematica
    a[n_] := (2*n-1)!! * Hypergeometric1F1[-n, 1-2*n, -2]; a[1] = 0;
    Table[a[n], {n, 0, 19}] (* Jean-François Alcover, Apr 05 2013 *)
    twounifll[{}]:={{}};twounifll[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@twounifll[Complement[set,s]]]/@Table[{i,j},{j,If[i==1,Select[set,2<#i+1&]]}];
    Table[Length[twounifll[Range[n]]],{n,0,14,2}] (* Gus Wiseman, Feb 27 2019 *)

Formula

a(n) = A003435(n)/(n!*2^n).
a(n) = 2*n*a(n-1)-2*(n-3)*a(n-2)-a(n-3) for n>4. [Corrected by Vasu Tewari, Apr 11 2010, and by R. J. Mathar, Oct 02 2013]
G.f.: x + ((1-x)/(1+x)) * Sum_{n>=0} A001147(n)*(x/(1+x)^2)^n. - Vladeta Jovovic, Jun 27 2007
a(n) ~ 2^(n+1/2)*n^n/exp(n+1). - Vaclav Kotesovec, Aug 13 2013
a(n) = (-1)^n*2*hypergeom([n, -n], [], 1/2) for n >= 2. - Peter Luschny, Nov 10 2016

Extensions

a(0)=1 prepended by Gus Wiseman, Feb 27 2019

A052848 Number of ordered set partitions with a designated element in each block and no block containing less than two elements.

Original entry on oeis.org

1, 0, 2, 3, 28, 125, 1146, 8827, 94200, 1007001, 12814390, 172114151, 2584755636, 41436880069, 721702509906, 13397081295795, 266105607506416, 5605474012933169, 125164378600050798, 2948082261121889983, 73122068527848758700, 1903894649651935410141
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

a(n) is the number of functional digraphs on {1,2,...,n} such that no node is at a distance greater than one from a cycle (A006153) and every recurrent element has at least one nonrecurrent element mapped to it. - Geoffrey Critzer, Dec 07 2012

Crossrefs

Cf. A000296.

Programs

  • Maple
    spec := [S,{B=Prod(Z,C),C=Set(Z,1 <= card),S=Sequence(B)},labeled]: seq(combstruct[count](spec, size=n), n=0..20);
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 1,
          add(a(n-j)*binomial(n, j)*j, j=2..n))
        end:
    seq(a(n), n=0..25);  # Alois P. Heinz, May 11 2016
  • Mathematica
    nn=20; a=x Exp[x]; First[Range[0,nn]! CoefficientList[Series[1/(1-x (Exp[x]-1+y)), {x,0,nn}], {y,x}]] Range[0,nn]! (* Geoffrey Critzer, Dec 07 2012 *)
  • Maxima
    a(n):=n!*sum((k!*stirling2(n-k,k))/(n-k)!,k,0,n/2); /* Vladimir Kruchinin, Nov 16 2011 */

Formula

E.g.f.: -1/(-1+x*exp(x)-x).
a(n) = n!*Sum_{k=0..floor(n/2)} k!*Stirling2(n-k,k)/(n-k)!. - Vladimir Kruchinin, Nov 16 2011
a(n) ~ n!/(1+r+r^2) * r^(n+2), where r = 1.23997788765655... is the root of the equation log(1+r)=1/r. - Vaclav Kotesovec, Oct 05 2013
a(0) = 1; a(n) = n * Sum_{k=2..n} binomial(n-1,k-1) * a(n-k). - Seiichi Manyama, Dec 04 2023

Extensions

Better name from Geoffrey Critzer, Dec 10 2012

A169985 Round phi^n to the nearest integer.

Original entry on oeis.org

1, 2, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778, 9349, 15127, 24476, 39603, 64079, 103682, 167761, 271443, 439204, 710647, 1149851, 1860498, 3010349, 4870847, 7881196, 12752043, 20633239, 33385282, 54018521, 87403803
Offset: 0

Views

Author

N. J. A. Sloane, Sep 26 2010

Keywords

Comments

Phi = (1+sqrt(5))/2, see A001622.
a(n) is the number of subsets of {1,2,...,n} with no two consecutive elements where n and 1 are considered to be consecutive. - Geoffrey Critzer, Sep 23 2013
Equals the Lucas sequence beginning at 1 (A000204) with 2 inserted between 1 and 3.
The Lucas sequence beginning at 2 (A000032) can be written as L(n) = phi^n + (-1/phi)^n. Since |(-1/phi)^n|<1/2 for n>1, this sequence is {L(n)} (with the first two terms switched). As a consequence, for n>1: a(n) is obtained by rounding phi^n up for even n and down for odd n; a(n) is also the nearest integer to 1/|phi^n - a(n)|. - Danny Rorabaugh, Apr 15 2015

Examples

			a(4) = 7 because we have: {}, {1}, {2}, {3}, {4}, {1,3}, {2,4}. - _Geoffrey Critzer_, Sep 23 2013
		

Crossrefs

Programs

  • GAP
    Concatenation([1,2], List([2..40], n-> Lucas(1,-1,n)[2] )); # G. C. Greubel, Jul 09 2019
    
  • Magma
    [Round(Sqrt(Fibonacci(2*n) + 2*Fibonacci(2*n-1))): n in [0..40]]; // Vincenzo Librandi, Apr 16 2015
    
  • Mathematica
    nn=34; CoefficientList[Series[(1+x-x^3)/(1-x-x^2),{x,0,nn}],x] (* Geoffrey Critzer, Sep 23 2013 *)
    Round[GoldenRatio^Range[0,40]] (* Harvey P. Dale, Jul 13 2014 *)
    Table[If[n<=1, n+1, LucasL[n]], {n, 0, 40}] (* G. C. Greubel, Jul 09 2019 *)
  • PARI
    my(x='x+O('x^40)); Vec((1+x-x^3)/(1-x-x^2)) \\ G. C. Greubel, Feb 13 2019
    
  • Python
    from gmpy2 import isqrt, fib2
    def A169985(n): return int((m:=isqrt(k:=(lambda x:(x[1]<<1)+x[0])(fib2(n<<1))))+(k-m*(m+1)>=1)) # Chai Wah Wu, Jun 19 2024
  • Sage
    [round(golden_ratio^n) for n in range(40)] # Danny Rorabaugh, Apr 16 2015
    

Formula

O.g.f.: (1 + x - x^3)/(1 - x - x^2). - Geoffrey Critzer, Sep 23 2013
a(n) = round(sqrt(F(2n) + 2*F(2n-1))), for n >= 0, allowing F(-1) = 1. Also phi^n -> sqrt(F(2n) + 2*F(2n-1)), within < 0.02% by n = 4, therefore converging rapidly. - Richard R. Forberg, Jun 23 2014
For k > 0, a(2k) = A169986(2k) and a(2k+1) = A014217(2k+1). - Danny Rorabaugh, Apr 15 2015
For n > 1, a(n) = A001610(n - 1) + 1. - Gus Wiseman, Feb 12 2019
a(n) = A000032(n) for n>=2. - G. C. Greubel, Jul 09 2019

A097514 Number of partitions of an n-set without blocks of size 2.

Original entry on oeis.org

1, 1, 1, 2, 6, 17, 53, 205, 871, 3876, 18820, 99585, 558847, 3313117, 20825145, 138046940, 959298572, 6974868139, 52972352923, 419104459913, 3446343893607, 29405917751526, 259930518212766, 2376498296500063, 22441988298860757, 218615700758838253
Offset: 0

Views

Author

Vladeta Jovovic, Aug 26 2004

Keywords

Crossrefs

Programs

  • Maple
    g:=exp(exp(x)-1-x^2/2): gser:=series(g,x=0,31): 1,seq(n!*coeff(gser,x^n),n=1..29); # Emeric Deutsch, Nov 18 2004
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 1, add(`if`(
           j=2, 0, a(n-j)*binomial(n-1, j-1)), j=1..n))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Mar 18 2015
  • Mathematica
    a[n_] := a[n] = If[n == 0, 1, Sum[If[j == 2, 0, a[n-j]*Binomial[n-1, j-1]], {j, 1, n}]]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, May 13 2015, after Alois P. Heinz *)

Formula

a(n) = Sum_{k=0..floor(n/2)} (-1)^k*binomial(n, 2*k)*(2*k-1)!!*Bell(n-2*k).
E.g.f.: exp(exp(x)-1-x^2/2). More generally, e.g.f. for number of partitions of an n-set which contain exactly q blocks of size p is x^(p*q)/(q!*p!^q)*exp(exp(x)-1-x^p/p!).

Extensions

More terms from Emeric Deutsch, Nov 18 2004

A124323 Triangle read by rows: T(n,k) is the number of partitions of an n-set having k singleton blocks (0<=k<=n).

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 1, 3, 0, 1, 4, 4, 6, 0, 1, 11, 20, 10, 10, 0, 1, 41, 66, 60, 20, 15, 0, 1, 162, 287, 231, 140, 35, 21, 0, 1, 715, 1296, 1148, 616, 280, 56, 28, 0, 1, 3425, 6435, 5832, 3444, 1386, 504, 84, 36, 0, 1, 17722, 34250, 32175, 19440, 8610, 2772, 840, 120, 45, 0, 1
Offset: 0

Views

Author

Emeric Deutsch, Oct 28 2006

Keywords

Comments

Row sums are the Bell numbers (A000110). T(n,0)=A000296(n). T(n,k) = binomial(n,k)*T(n-k,0). Sum(k*T(n,k),k=0..n) = A052889(n) = n*B(n-1), where B(q) are the Bell numbers (A000110).
Exponential Riordan array [exp(exp(x)-1-x),x]. - Paul Barry, Apr 23 2009
Sum_{k=0..n} T(n,k)*2^k = A000110(n+1) is the number of binary relations on an n-set that are both symmetric and transitive. - Geoffrey Critzer, Jul 25 2014
Also the number of set partitions of {1, ..., n} with k cyclical adjacencies (successive elements in the same block, where 1 is a successor of n). Unlike A250104, we count {{1}} as having 1 cyclical adjacency. - Gus Wiseman, Feb 13 2019

Examples

			T(4,2)=6 because we have 12|3|4, 13|2|4, 14|2|3, 1|23|4, 1|24|3 and 1|2|34 (if we take {1,2,3,4} as our 4-set).
Triangle starts:
     1
     0    1
     1    0    1
     1    3    0    1
     4    4    6    0    1
    11   20   10   10    0    1
    41   66   60   20   15    0    1
   162  287  231  140   35   21    0    1
   715 1296 1148  616  280   56   28    0    1
  3425 6435 5832 3444 1386  504   84   36    0    1
From _Gus Wiseman_, Feb 13 2019: (Start)
Row n = 5 counts the following set partitions by number of singletons:
  {{1234}}    {{1}{234}}  {{1}{2}{34}}  {{1}{2}{3}{4}}
  {{12}{34}}  {{123}{4}}  {{1}{23}{4}}
  {{13}{24}}  {{124}{3}}  {{12}{3}{4}}
  {{14}{23}}  {{134}{2}}  {{1}{24}{3}}
                          {{13}{2}{4}}
                          {{14}{2}{3}}
... and the following set partitions by number of cyclical adjacencies:
  {{13}{24}}      {{1}{2}{34}}  {{1}{234}}  {{1234}}
  {{1}{24}{3}}    {{1}{23}{4}}  {{12}{34}}
  {{13}{2}{4}}    {{12}{3}{4}}  {{123}{4}}
  {{1}{2}{3}{4}}  {{14}{2}{3}}  {{124}{3}}
                                {{134}{2}}
                                {{14}{23}}
(End)
From _Paul Barry_, Apr 23 2009: (Start)
Production matrix is
0, 1,
1, 0, 1,
1, 2, 0, 1,
1, 3, 3, 0, 1,
1, 4, 6, 4, 0, 1,
1, 5, 10, 10, 5, 0, 1,
1, 6, 15, 20, 15, 6, 0, 1,
1, 7, 21, 35, 35, 21, 7, 0, 1,
1, 8, 28, 56, 70, 56, 28, 8, 0, 1 (End)
		

Crossrefs

A250104 is an essentially identical triangle, differing only in row 1.
For columns see A000296, A250105, A250106, A250107.

Programs

  • Maple
    G:=exp(exp(z)-1+(t-1)*z): Gser:=simplify(series(G,z=0,14)): for n from 0 to 11 do P[n]:=sort(n!*coeff(Gser,z,n)) od: for n from 0 to 11 do seq(coeff(P[n],t,k),k=0..n) od; # yields sequence in triangular form
    # Program from R. J. Mathar, Jan 22 2015:
    A124323 := proc(n,k)
        binomial(n,k)*A000296(n-k) ;
    end proc:
  • Mathematica
    Flatten[CoefficientList[Range[0,10]! CoefficientList[Series[Exp[x y] Exp[Exp[x] - x - 1], {x, 0,10}], x], y]] (* Geoffrey Critzer, Nov 24 2011 *)
    sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
    Table[Length[Select[sps[Range[n]],Count[#,{}]==k&]],{n,0,9},{k,0,n}] (* _Gus Wiseman, Feb 13 2019 *)

Formula

T(n,k) = binomial(n,k)*[(-1)^(n-k)+sum((-1)^(j-1)*B(n-k-j), j=1..n-k)], where B(q) are the Bell numbers (A000110).
E.g.f.: G(t,z) = exp(exp(z)-1+(t-1)*z).
G.f.: 1/(1-xy-x^2/(1-xy-x-2x^2/(1-xy-2x-3x^2/(1-xy-3x-4x^2/(1-... (continued fraction). - Paul Barry, Apr 23 2009

A293037 E.g.f.: exp(1 + x - exp(x)).

Original entry on oeis.org

1, 0, -1, -1, 2, 9, 9, -50, -267, -413, 2180, 17731, 50533, -110176, -1966797, -9938669, -8638718, 278475061, 2540956509, 9816860358, -27172288399, -725503033401, -5592543175252, -15823587507881, 168392610536153, 2848115497132448, 20819319685262839
Offset: 0

Views

Author

Seiichi Manyama, Sep 28 2017

Keywords

Crossrefs

Column k=1 of A293051.
Column k=1 of A335977.
Cf. A000587 (k=0), this sequence (k=1), A293038 (k=2), A293039 (k=3), A293040 (k=4).

Programs

  • Maple
    f:= series(exp(1 + x - exp(x)), x= 0, 101): seq(factorial(n) * coeff(f, x, n), n = 0..30); # Muniru A Asiru, Oct 31 2017
    # second Maple program:
    b:= proc(n, t) option remember; `if`(n=0, 1-2*t,
          add(b(n-j, 1-t)*binomial(n-1, j-1), j=1..n))
        end:
    a:= n-> b(n+1, 1):
    seq(a(n), n=0..35);  # Alois P. Heinz, Dec 01 2021
  • Mathematica
    m = 26; Range[0, m]! * CoefficientList[Series[Exp[1 + x - Exp[x]], {x, 0, m}], x] (* Amiram Eldar, Jul 06 2020 *)
    Table[Sum[Binomial[n, k] * BellB[k, -1], {k, 0, n}], {n, 0, 30}] (* Vaclav Kotesovec, Jul 06 2020 *)
  • PARI
    my(N=40, x='x+O('x^N)); Vec(serlaplace(exp(-exp(x)+1+x)))
    
  • PARI
    a(n) = if(n==0, 1, -sum(k=0, n-2, binomial(n-1, k)*a(k))); \\ Seiichi Manyama, Aug 02 2021

Formula

a(n) = exp(1) * Sum_{k>=0} (-1)^k*(k + 1)^n/k!. - Ilya Gutkovskiy, Jun 13 2019
a(n) = Sum_{k=0..n} binomial(n,k) * Bell(k, -1). - Vaclav Kotesovec, Jul 06 2020
a(0) = 1; a(n) = - Sum_{k=0..n-2} binomial(n-1,k) * a(k). - Seiichi Manyama, Aug 02 2021

A080107 Number of fixed points of permutation of SetPartitions under {1,2,...,n}->{n,n-1,...,1}. Number of symmetric arrangements of non-attacking rooks on upper half of n X n chessboard.

Original entry on oeis.org

1, 1, 2, 3, 7, 12, 31, 59, 164, 339, 999, 2210, 6841, 16033, 51790, 127643, 428131, 1103372, 3827967, 10269643, 36738144, 102225363, 376118747, 1082190554, 4086419601, 12126858113, 46910207114, 143268057587, 566845074703, 1778283994284, 7186474088735
Offset: 0

Views

Author

Wouter Meeussen, Mar 15 2003

Keywords

Comments

Even-numbered terms a(2k) are A002872: 2,7,31,164,999 ("Sorting numbers"); odd-numbered terms are its binomial transform, A080337. The symmetrical set partitions of {-n,...,-1,0,1,...,n} can be classified by the partition containing 0. Thus we get the sum over k of {n choose k} times the number of symmetrical set partitions of 2n-2k elements. - Don Knuth, Nov 23 2003
Number of partitions of n numbers that are symmetrical and cannot be nested (i.e., include a pattern of the form abab). - Douglas Boffey, May 21 2015
Number of achiral color patterns in a row or loop of length n. Two color patterns are equivalent if the colors are permuted. - Robert A. Russell, Apr 23 2018
Also the number of self-complementary set partitions of {1, ..., n}. The complement of a set partition pi of {1, ..., n} is defined as n + 1 - pi (elementwise) on page 3 of Callan. For example, the complement of {{1,5},{2},{3,6},{4}} is {{1,4},{2,6},{3},{5}}. - Gus Wiseman, Feb 13 2019

Examples

			Of the set partitions of 4, the following 7 are invariant under 1->4, 2->3, 3->2, 4->1: {{1,2,3,4}}, {{1,2},{3,4}}, {{1,4},{2,3}}, {{1,3},{2,4}}, {{1},{2,3},{4}}, {{1,4},{2},{3}}, {{1},{2},{3},{4}}, so a(4)=7.
For a(4)=7, the row patterns are AAAA, AABB, ABAB, ABBA, ABBC, ABCA, and ABCD (same as previous example).  The loop patterns are AAAA, AAAB, AABB, AABC, ABAB, ABAC, and ABCD. - _Robert A. Russell_, Apr 23 2018
From _Gus Wiseman_, Feb 13 2019: (Start)
The a(1) = 1 through a(5) = 12 self-complementary set partitions:
  {{1}}  {{12}}    {{123}}      {{1234}}        {{12345}}
         {{1}{2}}  {{13}{2}}    {{12}{34}}      {{1245}{3}}
                   {{1}{2}{3}}  {{13}{24}}      {{135}{24}}
                                {{14}{23}}      {{15}{234}}
                                {{1}{23}{4}}    {{1}{234}{5}}
                                {{14}{2}{3}}    {{12}{3}{45}}
                                {{1}{2}{3}{4}}  {{135}{2}{4}}
                                                {{14}{25}{3}}
                                                {{15}{24}{3}}
                                                {{1}{24}{3}{5}}
                                                {{15}{2}{3}{4}}
                                                {{1}{2}{3}{4}{5}}
(End)
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.5 (p. 765).

Crossrefs

Programs

  • Mathematica
    < Range[n, 1, -1]]; t= 1 + RankSetPartition /@ t; t= ToCycles[t]; t= Cases[t, {_Integer}]; Length[t], {n, 7}]
    (* second program: *)
    QB[n_, q_] := QB[n, q] = Sum[QB[j, q] QBinomial[n-1, j, q], {j, 0, n-1}] // FunctionExpand // Simplify; QB[0, q_]=1; QB[1, q_]=1; Table[cc = CoefficientList[QB[n, q], q]; cc.Table[(-1)^(k+1), {k, 1, Length[cc]}], {n, 0, 30}] (* Jean-François Alcover, Feb 29 2016, after Paul D. Hanna *)
    (* Ach[n, k] is the number of achiral color patterns for a row or loop of n
      colors containing exactly k different colors *)
    Ach[n_, k_] := Ach[n, k] = If[n<2, Boole[n==k && n>=0],
      k Ach[n-2, k] + Ach[n-2, k-1] + Ach[n-2, k-2]]
    Table[Sum[Ach[n, k], {k, 0, n}], {n, 0, 30}] (* Robert A. Russell, Apr 23 2018 *)
    x[n_] := x[n] = If[n < 2, n+1, 2x[n-1] + (n-1)x[n-2]]; (* A005425 *)
    Table[Sum[StirlingS2[Ceiling[n/2], k] x[k-Mod[n, 2]], {k, 0, Ceiling[n/2]}],
      {n, 0, 30}] (* Robert A. Russell, Apr 27 2018, after Knuth reference *)

Formula

Knuth gives recurrences and generating functions.
a(n) = Sum_{k=0..t(n)} (-1)^k*A125810(n,k) where A125810 is a triangle of coefficients for a q-analog of the Bell numbers and t(n)=A125811(n)-1. - Paul D. Hanna, Jan 19 2009
From Robert A. Russell, Apr 23 2018: (Start)
a(n) = Sum_{k=0..n} Ach(n,k) where
Ach(n,k) = [n>1]*(k*Ach(n-2,k)+Ach(n-2,k-1)+Ach(n-2,k-2)) + [n<2]*[n==k]*[n>=0].
a(n) = 2*A103293(n+1) - A000110(n). (End)
a(n) = [n==0 mod 2]*Sum_{k=0..n/2} Stirling2(n/2, k)*A005425(k) + [n==1 mod 2] * Sum_{k=1..(n+1)/2} Stirling2((n+1)/2, k) * A005425(k-1). (from Knuth reference)
a(n) = 2*A084708(n) - A084423(n). - Robert A. Russell, Apr 27 2018

Extensions

Offset set to 0 by Alois P. Heinz, May 23 2015
Previous Showing 11-20 of 131 results. Next