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

A002464 Hertzsprung's problem: ways to arrange n non-attacking kings on an n X n board, with 1 in each row and column. Also number of permutations of length n without rising or falling successions.

Original entry on oeis.org

1, 1, 0, 0, 2, 14, 90, 646, 5242, 47622, 479306, 5296790, 63779034, 831283558, 11661506218, 175203184374, 2806878055610, 47767457130566, 860568917787402, 16362838542699862, 327460573946510746, 6880329406055690790, 151436547414562736234, 3484423186862152966838
Offset: 0

Views

Author

Keywords

Comments

Permutations of 12...n such that none of the following occur: 12, 23, ..., (n-1)n, 21, 32, ..., n(n-1).
This sequence is also the solution to the 'toast problem' devised by my house-mates and me as math undergraduates some 27 years ago: Given a toast rack with n slots, how many ways can the slices be removed so that no two consecutive slices are removed from adjacent slots? - David Jones (david.jones(AT)zetnet.co.uk), Oct 24 2003
This sequence was also derived by the late D. P. Robbins. - David Callan, Nov 04 2003
Another interpretation: number of permutations of n containing exactly n different patterns of size n-1. - Olivier Gérard, Nov 05 2007
Number of directed Hamiltonian paths in the complement of the n-path graph P_n. - Andrew Howroyd, Mar 16 2016
There is an obvious connection between the two descriptions of the sequence: Replace the chessboard with a n X n zero-matrix and each king with "1". This matrix will transform the vector (1,2,..,n) into a permutation such that adjacent components do not differ by 1. The reverse is also true: Any such transformation is a solution of the king problem. - Gerhard Kirchner, Feb 10 2017
A formula of Poulet (1919) relates this to A326411: a(n) = T(n+2,1)/(n+2) + 2*T(n+1,1)/(n+1) + T(n,1)/n, where T(i,j) = A326411(i,j). - N. J. A. Sloane, Mar 08 2022
For the number of these permutations without fixed points see A288208. - Wolfdieter Lang, May 22 2025

Examples

			a(4) = 2: 2413, 3142.
a(5) = 14 corresponds to these 14 permutations of length 5: 13524, 14253, 24135, 24153, 25314, 31425, 31524, 35142, 35241, 41352, 42513, 42531, 52413, 53142.
		

References

  • W. Ahrens, Mathematische Unterhaltungen und Spiele. Teubner, Leipzig, Vol. 1, 3rd ed., 1921; Vol. 2, 2nd ed., 1918. See Vol. 1, p. 271.
  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 263.
  • 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).
  • R. P. Stanley, Enumerative Combinatorics, Cambridge, Vol. 2, 1999; see Problem 6.40.

Crossrefs

Equals 2*A001266(n) for n >= 2. A diagonal of A001100. Cf. A010028.
Column k=1 of A333706.

Programs

  • Maple
    A002464 := proc(n) options remember; if n <= 1 then 1 elif n <= 3 then 0 else (n+1)*A002464(n-1)-(n-2)*A002464(n-2)-(n-5)*A002464(n-3)+(n-3)*A002464(n-4); fi; end;
  • Mathematica
    (* computation from the permutation class *)
    g[ L_ ] := Apply[ And, Map[ #>1&, L ] ]; f[ n_ ] := Length[ Select[ Permutations[ Range[ n ] ], g[ Rest[ Abs[ RotateRight[ # ]-# ] ] ]& ] ]; Table[ f[ n ], {n, 1, 8} ] (* Erich Friedman *)
    (* or direct computation of terms *)
    Table[n! + Sum[(-1)^r*(n-r)!*Sum[2^c *Binomial[r-1,c-1] *Binomial[n-r,c], {c,1,r}], {r,1,n-1}], {n,1,30}] (* Vaclav Kotesovec, Mar 28 2011 *)
    (* or from g.f. *)
    M = 30; CoefficientList[Sum[n!*x^n*(1-x)^n/(1+x)^n, {n, 0, M}] + O[x]^M, x] (* Jean-François Alcover, Jul 07 2015 *)
    CoefficientList[Series[Exp[(1 + x)/((-1 + x) x)] (1 + x) Gamma[0, (1 + x)/((-1 + x) x)]/((-1 + x) x), {x, 0, 20}], x] (* Eric W. Weisstein, Apr 11 2018 *)
    RecurrenceTable[{a[n] == (n + 1) a[n - 1] - (n - 2) a[n - 2] - (n - 5) a[n - 3] + (n - 3) a[n - 4], a[0] == a[1] == 1, a[2] == a[3] == 0}, a, {n, 0, 20}] (* Eric W. Weisstein, Apr 11 2018 *)
  • PARI
    N = 66;  x = 'x + O('x^N);
    gf = sum(n=0,N, n!*(x*(1-x))^n/(1+x)^n );
    v = Vec(gf) /* Joerg Arndt, Apr 17 2013 */
    
  • Python
    from math import factorial, comb
    def A002464(n): return factorial(n)+sum((-1 if k&1 else 1)*factorial(n-k)*sum(comb(k-1,t-1)*comb(n-k,t)<Chai Wah Wu, Feb 19 2024

Formula

If n = 0 or 1 then a(n) = 1; if n = 2 or 3 then a(n) = 0; otherwise a(n) = (n+1)*a(n-1) - (n-2)*a(n-2) - (n-5)*a(n-3) + (n-3)*a(n-4).
G.f.: Sum_{n >= 0} n!*x^n*(1-x)^n/(1+x)^n. - Philippe Flajolet
G.f.: e^((1 + x)/((-1 + x) * x)) * (1 + x) * Gamma(0, (1 + x)/((-1 + x) * x))/((-1 + x) * x). - Eric W. Weisstein, May 16 2014
Let S_{n, k} = number of permutations of 12...n with exactly k rising or falling successions. Let S[n](t) = Sum_{k >= 0} S_{n, k}*t^k. Then S[0] = 1; S[1] = 1; S[2] = 2*t; S[3] = 4*t+2*t^2; for n >= 4, S[n] = (n+1-t)*S[n-1] - (1-t)*(n-2+3*t)*S[n-2] - (1-t)^2*(n-5+t)*S[n-3] + (1-t)^3*(n-3)*S[n-4].
a(n) = n! + Sum_{k=1..n} (-1)^k * Sum_{t=1..k} binomial(k-1,t-1) * binomial(n-k,t) * 2^t * (n-k)!. - Max Alekseyev, Jan 29 2006
a(n) = Sum_{k=0..n} (-1)^(n-k)*k!*b(n,k), where g.f. for b(n,k) is (1-x)/(1-(1+y)*x-y*x^2), cf. A035607. - Vladeta Jovovic, Nov 24 2007
Asymptotic (M. Abramson and W. Moser, 1966): a(n)/n! ~ (1 - 2/n^2 - 10/(3*n^3) - 6/n^4 - 154/(15*n^5) - 88/(9*n^6) + 5336/(105*n^7) + 1612/(3*n^8) + 2098234/(567*n^9) + 36500686/(1575*n^10) + ... )/e^2. - Vaclav Kotesovec, Apr 19 2011, extended Dec 27 2020
Conjecture: a(n) = Sum_{k=1..n} k!*A080246(n-1, k-1) for n > 0. - John Keith, Nov 02 2020
Proof: a(n) = Sum_{k=1..n} k!*A080246(n-1, k-1) for n > 0. Since a(n) = Sum_{k=0..n-1} (-1)^k*(n-k)!*Sum_{i=0..k} binomial(n-k,i)*binomial(n-1-i,k-i) (M. Abramson and W. Moser, 1966) which is Sum_{k=1..n} (-1)^(k-1)(n-k+1)!*Sum{i=0..k-1} binomial(n-k+1,i)*binomial(n-1-i,k-1-i) = Sum_{k=1..n} (-1)^(n-k)(k!)*Sum_{i=0..n-k} binomial(k,i)*binomial(n-1-i,n-k-i) = k!*A080246(n-1, k-1) as (-1)^(n-k) = (-1)^(n+k) and binomial(n-1-i,k-1) = binomial(n-1-i,n-k-i). - Alex McGaw, Apr 13 2023
a(n+2) = (n+2)! - Sum_{j=0..n} (-1)^j*(n+1-j)!*2*A104698(n, j), for n >= 0 (Abramson and Moser, p. 1250, (III), N_0(n+2), last line, rewritten). - Wolfdieter Lang, May 14 2025

Extensions

Merged with the old A001100, Aug 19 2003
Kaplansky reference from David Callan, Oct 29 2003
Tauraso reference from Parthasarathy Nambi, Dec 21 2006
Edited by Jon E. Schoenfield, Jan 31 2015

A137774 Number of ways to place n nonattacking empresses on an n X n board.

Original entry on oeis.org

1, 2, 2, 8, 20, 94, 438, 2766, 19480, 163058, 1546726, 16598282, 197708058, 2586423174, 36769177348, 563504645310, 9248221393974, 161670971937362, 2996936692836754, 58689061747521430, 1210222434323163704, 26204614054454840842, 594313769819021397534, 14086979362268860896282
Offset: 1

Views

Author

Vaclav Kotesovec, Jan 27 2011

Keywords

Comments

An empress moves like a rook and a knight.

Crossrefs

Formula

Asymptotics (Vaclav Kotesovec, Jan 26 2011): a(n)/n! -> 1/e^4.
General asymptotic formulas for number of ways to place n nonattacking pieces rook + leaper[r,s] on an n X n board:
a(n)/n! -> 1/e^2 for 0
a(n)/n! -> 1/e^4 for 0

Extensions

Terms a(16)-a(17) from Vaclav Kotesovec, Feb 06 2011
Terms a(18)-a(19) from Wolfram Schubert, Jul 24 2011
Terms a(20)-a(24) (computed by Wolfram Schubert), Vaclav Kotesovec, Aug 25 2012

A110128 Number of permutations p of 1,2,...,n satisfying |p(i+2)-p(i)| not equal to 2 for all 0

Original entry on oeis.org

1, 1, 2, 4, 16, 44, 200, 1288, 9512, 78652, 744360, 7867148, 91310696, 1154292796, 15784573160, 232050062524, 3648471927912, 61080818510972, 1084657970877416, 20361216987032284, 402839381030339816, 8377409956454452732
Offset: 0

Author

Roberto Tauraso, A. Nicolosi and G. Minenkov, Jul 13 2005

Keywords

Comments

When n is even: 1) Number of ways that n persons seated at a rectangular table with n/2 seats along the two opposite sides can be rearranged in such a way that neighbors are no more neighbors after the rearrangement. 2) Number of ways to arrange n kings on an n X n board, with 1 in each row and column, which are non-attacking with respect to the main four quadrants.
a(n) is also number of ways to place n nonattacking pieces rook + alfil on an n X n chessboard (Alfil is a leaper [2,2]) [From Vaclav Kotesovec, Jun 16 2010]
Note that the conjectured recurrence was based on the 600-term b-file, not the other way round. - N. J. A. Sloane, Dec 07 2022

Crossrefs

Column k=2 of A333706.

Formula

A formula is given in the Tauraso reference.
Asymptotic (R. Tauraso 2006, quadratic term V. Kotesovec 2011): a(n)/n! ~ (1 + 4/n + 8/n^2)/e^2.
a(n) ~ exp(-2) * n! * (1 + 4/n + 8/n^2 + 68/(3*n^3) + 242/(3*n^4) + 1692/(5*n^5) + 72802/(45*n^6) + 2725708/(315*n^7) + 16083826/(315*n^8) + 186091480/(567*n^9) + 32213578294/(14175*n^10) + ...), based on the recurrence by Manuel Kauers. - Vaclav Kotesovec, Dec 05 2022

Extensions

Edited by N. J. A. Sloane at the suggestion of Vladeta Jovovic, Jan 01 2008
Terms a(33)-a(35) from Vaclav Kotesovec, Apr 20 2012

A078603 Number of ways of arranging the numbers 1..n in a circle so that adjacent numbers do not differ by 1 mod n.

Original entry on oeis.org

1, 0, 0, 0, 2, 6, 46, 354, 3106, 29926, 315862, 3628906, 45132474, 604534846, 8680957902, 133082437730, 2169964347282, 37505486702678, 685046187718022, 13186335387855770, 266816610979894058, 5662225862272325550
Offset: 1

Author

N. J. A. Sloane, Dec 11 2002

Keywords

Examples

			a(5) = 2: 1 3 5 2 4, 1 4 2 5 3; a(6) = 6: 1 4 6 2 5 3, 1 5 2 4 6 3, 1 5 3 6 2 4, 1 3 6 4 2 5, 1 4 2 6 3 5, 1 3 5 2 6 4.
		

Crossrefs

Twice A002816.
The sequence n*a(n) is A089222.
See also A078628.

Formula

For n>1, a(n) = 2*A002816(n).

Extensions

The sequence was missing a zero; also added a cross-reference Joel B. Lewis, Jan 28 2010

A078630 Numerators of coefficients of asymptotic expansion of probability p(n) (see A002816) in powers of 1/n.

Original entry on oeis.org

1, -4, 0, 20, 58, 796, 7858, 40324, 140194, 2444744, 40680494, -7117319032, -149539443124, -223750776484, -4960419494993024, -46146161037854692, -689434674121075448, -132496988938839119444, -9686633414582239854958, -442788087926096759821484
Offset: 0

Author

N. J. A. Sloane, Dec 13 2002

Keywords

Examples

			p(n) = exp(-2)*(1 - 4/n + 20/(3n^3) + 58/(3n^4) + ...).
		

Crossrefs

Programs

  • Mathematica
    t = 15;
    y[n_]:=(1+Sum[Subscript[p,k]/n^k,{k,1,t}]);
    mul=1;start=9; If[t>9,mul=n^(t-9);start=t];
    w=Apart[Expand[mul*Simplify[
    y[n]*n*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    -((3*n-30)*y[n-11]
    +(6*n-45)*y[n-10]*(n-10)
    +(5*n+18)*y[n-9]*(n-9)*(n-10)
    -(8*n-139)*y[n-8]*(n-8)*(n-9)*(n-10)
    -(26*n-204)*y[n-7]*(n-7)*(n-8)*(n-9)*(n-10)
    -(4*n-30)*y[n-6]*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    +(26*n-148)*y[n-5]*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    +(8*n-74)*y[n-4]*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    -(9*n-18)*y[n-3]*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    -(2*n-15)*y[n-2]*(n-2)*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    +(n+2)*y[n-1]*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10))],n],n];
    sol=Solve[Table[Coefficient[w,n,j]==0,{j,start,start-t+1,-1}]];
    asympt=y[n]/.sol[[1]];
    Table[Numerator[Coefficient[asympt,n,-j]],{j,0,t}] (* Vaclav Kotesovec, Apr 06 2012 *)

Extensions

Terms a(5)-a(19) from Vaclav Kotesovec, Apr 06 2012 (terms a(5)-a(7) were wrong, see A089222 for more information)

A078631 Denominators of coefficients of asymptotic expansion of probability p(n) (see A002816) in powers of 1/n.

Original entry on oeis.org

1, 1, 1, 3, 3, 15, 45, 63, 63, 405, 14175, 51975, 93555, 15795, 42567525, 49116375, 91216125, 2170943775, 19538493975, 109185701625, 3093594879375, 10257709336875, 428772250281375, 281764621613475, 158210081654625, 160789593855515625
Offset: 0

Author

N. J. A. Sloane, Dec 13 2002

Keywords

Examples

			p(n) = exp(-2)*(1 - 4/n + 20/(3n^3) + 58/(3n^4) + ...).
		

Crossrefs

Programs

  • Mathematica
    t = 15;
    y[n_]:=(1+Sum[Subscript[p,k]/n^k,{k,1,t}]);
    mul=1;start=9; If[t>9,mul=n^(t-9);start=t];
    w=Apart[Expand[mul*Simplify[
    y[n]*n*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    -((3*n-30)*y[n-11]
    +(6*n-45)*y[n-10]*(n-10)
    +(5*n+18)*y[n-9]*(n-9)*(n-10)
    -(8*n-139)*y[n-8]*(n-8)*(n-9)*(n-10)
    -(26*n-204)*y[n-7]*(n-7)*(n-8)*(n-9)*(n-10)
    -(4*n-30)*y[n-6]*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    +(26*n-148)*y[n-5]*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    +(8*n-74)*y[n-4]*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    -(9*n-18)*y[n-3]*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    -(2*n-15)*y[n-2]*(n-2)*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10)
    +(n+2)*y[n-1]*(n-1)*(n-2)*(n-3)*(n-4)*(n-5)*(n-6)*(n-7)*(n-8)*(n-9)*(n-10))],n],n];
    sol=Solve[Table[Coefficient[w,n,j]==0,{j,start,start-t+1,-1}]];
    asympt=y[n]/.sol[[1]];
    Table[Denominator[Coefficient[asympt,n,-j]],{j,0,t}] (* Vaclav Kotesovec, Apr 06 2012 *)

Extensions

Terms a(8)-a(25) from Vaclav Kotesovec, Apr 06 2012

A326390 The number of ways of seating n people around a table for the second time so that k pairs are maintained. T(n,k) read by rows.

Original entry on oeis.org

1, 0, 1, 0, 0, 2, 0, 0, 0, 6, 0, 0, 16, 0, 8, 10, 0, 50, 50, 0, 10, 36, 144, 180, 240, 108, 0, 12, 322, 980, 1568, 1274, 686, 196, 0, 14, 2832, 8704, 11840, 10240, 4832, 1536, 320, 0, 16, 27954, 81000, 108054, 85050, 43902, 13446, 2970, 486, 0, 18, 299260, 834800, 1071700, 828400, 416200, 141520, 31000, 5200, 700, 0, 20
Offset: 0

Author

Witold Tatkiewicz, Jul 03 2019

Keywords

Comments

Definition requires "pairs" and for n=0 it is assumed that there is 1 way of seating 0 people around a table for the second time so that 0 pairs are maintained and 1 person forms only one pair with him/herself. Therefore T(0,0)=1, T(1,0)=0 and T(1,1)=1.
Sum of each row is equal to n!.
Weighted average of each row using k as weights converges to 2 for large n and is given with following formula: (Sum_{k} T(n,k)*k)/n! = 2/(n-1) + 2 (conjectured).

Examples

			Assuming initial order was {1,2,3,4,5} (therefore 1 and 5 forms pair as first and last person are neighbors in case of round table) there are 5 sets of ways of seating them again so that 3 pairs are conserved: {1,2,3,5,4}, {2,3,4,1,5}, {3,4,5,2,1}, {4,5,1,3,2}, {5,1,2,4,3}. Since within each set we allow for rotation ({1,2,3,5,4} and {2,3,5,4,1} are different) and reflection ({1,2,3,5,4} and {4,5,3,2,1} are also different) the total number of ways is 5*2*5 and therefore T(5,3)=50.
Unfolded table with n individuals (rows) forming k pairs (columns):
    0    1    2    3    4    5    6    7
0   1
1   0    1
2   0    0    2
3   0    0    0    6
4   0    0   16    0    8
5  10    0   50   50    0   10
6  36  144  180  240  108    0   12
7 322  980 1568 1274  686  196    0   14
		

Crossrefs

Cf. A089222 (column k=0).
Cf. A000142 sum of each row.
Cf. A326397 (disregards reflection symmetry), A326404 (disregards circular symmetry), A326411 (disregards both circular and reflection symmetry).

Programs

  • Java
    See Links section

Formula

T(n,n) = 2*n for n > 2;
T(n,n-1) = 0 for n > 1;
T(n,n-2) = n^2*(n-3) for n > 3 (conjectured);
T(n,n-3) = (3/4)*n^4 + 6*n^3 + (2/3)*n^2 - 14*n + 6 for n > 4 (conjectured);
T(n,n-4) = (25/12)*n^5 + (73/6)*n^4 + (5/4)*n^3 - (253/6)*n^2 + (152/3)*n - 24 for n > 5 (conjectured);
T(n,n-5) = (52/15)*n^6 + (77/3)*n^5 + 14*n^4 - (194/3)*n^3 + (4628/15)*n^2 - 273*n + 130 for n > 5 (conjectured);
T(n,n-6) = (707/120)*n^7 + (2093/40)*n^6 + (2009/40)*n^5 - (245/8)*n^4 + (78269/60)*n^3 - (18477/10)*n^2 + (21294/10)*n - 684 for n > 6 (conjectured).
Showing 1-7 of 7 results.