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

A242530 Number of cyclic arrangements of S={1,2,...,2n} such that the binary expansions of any two neighbors differ by one bit.

Original entry on oeis.org

0, 0, 1, 0, 2, 8, 0, 0, 224, 754, 0, 26256, 0, 0, 22472304, 0, 90654576, 277251016, 0, 7852128780
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

Here, a(n)=NPC(2n;S;P) is the count of all neighbor-property cycles for a specific set S of 2n elements and a pair-property P. For more details, see the link and A242519.
In this case the property P is the Gray condition. The choice of the set S is important; when it is replaced by {0,1,2,...,2n-1}, the sequence changes completely and becomes A236602.

Examples

			The two cycles for n=5 (cycle length 10) are:
C_1={1,3,7,5,4,6,2,10,8,9}, C_2={1,5,4,6,7,3,2,10,8,9}.
		

Crossrefs

Programs

  • Mathematica
    A242530[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, 2 n]]]], 0]/2;
    j1f[x_] := Join[{1}, x, {1}];
    btf[x_] := Module[{i},
       Table[DigitCount[BitXor[x[[i]], x[[i + 1]]], 2, 1], {i,
         Length[x] - 1}]];
    lpf[x_] := Length[Select[btf[x], # != 1 &]];
    Table[A242530[n], {n, 1, 5}]
     (* OR, a less simple, but more efficient implementation. *)
    A242530[n_, perm_, remain_] := Module[{opt, lr, i, new},
       If[remain == {},
         If[DigitCount[BitXor[First[perm], Last[perm]], 2, 1] == 1, ct++];
         Return[ct],
         opt = remain; lr = Length[remain];
         For[i = 1, i <= lr, i++,
          new = First[opt]; opt = Rest[opt];
          If[DigitCount[BitXor[Last[perm], new], 2, 1] != 1, Continue[]];
          A242530[n, Join[perm, {new}],
           Complement[Range[2, 2 n], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Table[ct = 0; A242530[n, {1}, Range[2, 2 n]]/2, {n, 1, 10}] (* Robert Price, Oct 25 2018 *)

Extensions

a(16)-a(20) from Fausto A. C. Cariboni, May 10 2017, May 15 2017

A242531 Number of cyclic arrangements of S={1,2,...,n} such that the difference of any two neighbors is a divisor of their sum.

Original entry on oeis.org

0, 1, 1, 1, 1, 4, 3, 9, 26, 82, 46, 397, 283, 1675, 9938, 19503, 10247, 97978, 70478, 529383, 3171795, 7642285, 3824927, 48091810, 116017829, 448707198, 1709474581, 6445720883, 3009267707, 51831264296
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(n;S;P) is the count of all neighbor-property cycles for a specific set S of n elements and a specific pair-property P. For more details, see the link and A242519.

Examples

			The only such cycle of length n=5 is {1,2,4,5,3}.
For n=7 there are three solutions: C_1={1,2,4,5,7,6,3}, C_2={1,2,4,6,7,5,3}, C_3={1,2,6,7,5,4,3}.
		

Crossrefs

Programs

  • Mathematica
    A242531[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, n]]]], 0]/2;
    j1f[x_] := Join[{1}, x, {1}];
    dvf[x_] := Module[{i},
       Table[Divisible[x[[i]] + x[[i + 1]], x[[i]] - x[[i + 1]]], {i,
         Length[x] - 1}]];
    lpf[x_] := Length[Select[dvf[x], ! # &]];
    Join[{0, 1}, Table[A242531[n], {n, 3, 10}]]
    (* OR, a less simple, but more efficient implementation. *)
    A242531[n_, perm_, remain_] := Module[{opt, lr, i, new},
       If[remain == {},
         If[Divisible[First[perm] + Last[perm],
           First[perm] - Last[perm]], ct++];
         Return[ct],
         opt = remain; lr = Length[remain];
         For[i = 1, i <= lr, i++,
          new = First[opt]; opt = Rest[opt];
          If[! Divisible[Last[perm] + new, Last[perm] - new], Continue[]];
          A242531[n, Join[perm, {new}],
           Complement[Range[2, n], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Join[{0, 1}, Table[ct = 0; A242531[n, {1}, Range[2, n]]/2, {n, 3, 13}]] (* Robert Price, Oct 25 2018 *)

Extensions

a(24)-a(28) from Fausto A. C. Cariboni, May 25 2017
a(29) from Fausto A. C. Cariboni, Jul 09 2020
a(30) from Fausto A. C. Cariboni, Jul 14 2020

A242532 Number of cyclic arrangements of S={2,3,...,n+1} such that the difference of any two neighbors is greater than 1, and a divisor of their sum.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 20, 39, 0, 0, 0, 0, 319, 967, 0, 0, 1464, 6114, 16856, 44370, 0, 0, 0, 0, 2032951, 8840796, 12791922, 101519154, 0, 0
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(n;S;P) is the count of all neighbor-property cycles for a specific set S of n elements and a specific pair-property P. For more details, see the link and A242519.
For this property P and sets {0,1,2,...,n-1} or {1,2,...,n} the problem does not appear to have any solution.
a(40)=a(41)=a(42)=a(43)=a(46)=a(47)=0. - Fausto A. C. Cariboni, May 17 2017

Examples

			The shortest such cycle is of length n=9: {2,4,8,10,5,7,9,3,6}.
The next a(n)>0 occurs for n=14 and has 20 solutions.
The first and the last of these are:
C_1={2,4,8,10,5,7,14,12,15,13,11,9,3,6},
C_2={2,4,12,15,13,11,9,3,5,7,14,10,8,6}.
		

Crossrefs

Programs

  • Mathematica
    A242532[n_] := Count[Map[lpf, Map[j2f, Permutations[Range[3, n + 1]]]], 0]/2;
    j2f[x_] := Join[{2}, x, {2}];
    dvf[x_] := Module[{i},
       Table[Abs[x[[i]] - x[[i + 1]]] > 1 &&
         Divisible[x[[i]] + x[[i + 1]], x[[i]] - x[[i + 1]]], {i,
         Length[x] - 1}]];
    lpf[x_] := Length[Select[dvf[x], ! # &]];
    Table[A242532[n], {n, 1, 10}]
    (* OR, a less simple, but more efficient implementation. *)
    A242532[n_, perm_, remain_] := Module[{opt, lr, i, new},
       If[remain == {},
         If[Abs[First[perm] - Last[perm]] > 1 &&
           Divisible[First[perm] + Last[perm], First[perm] - Last[perm]],
          ct++];
         Return[ct],
         opt = remain; lr = Length[remain];
         For[i = 1, i <= lr, i++,
          new = First[opt]; opt = Rest[opt];
          If[Abs[Last[perm] - new] <= 1 || !
             Divisible[Last[perm] + new, Last[perm] - new], Continue[]];
          A242532[n, Join[perm, {new}],
           Complement[Range[3, n + 1], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Table[ct = 0; A242532[n, {2}, Range[3, n + 1]]/2, {n, 1, 15}] (* Robert Price, Oct 25 2018 *)

Extensions

a(29)-a(37) from Fausto A. C. Cariboni, May 17 2017

A242533 Number of cyclic arrangements of S={1,2,...,2n} such that the difference of any two neighbors is coprime to their sum.

Original entry on oeis.org

1, 1, 2, 36, 288, 3888, 200448, 4257792, 139511808, 11813990400, 532754620416
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(2n;S;P) is the count of all neighbor-property cycles for a specific set S of 2n elements and a specific pair-property P. For more details, see the link and A242519.
Conjecture: in this case it seems that NPC(n;S;P)=0 for all odd n, so only the even ones are listed. This is definitely not the case when the property P is replaced by its negation (see A242534).

Examples

			For n=4, the only cycle is {1,2,3,4}.
The two solutions for n=6 are: C_1={1,2,3,4,5,6} and C_2={1,4,3,2,5,6}.
		

Crossrefs

Programs

  • Mathematica
    A242533[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, 2 n]]]], 0]/2;
    j1f[x_] := Join[{1}, x, {1}];
    lpf[x_] := Length[Select[cpf[x], ! # &]];
    cpf[x_] := Module[{i},
       Table[CoprimeQ[x[[i]] - x[[i + 1]], x[[i]] + x[[i + 1]]], {i,
         Length[x] - 1}]];
    Join[{1}, Table[A242533[n], {n, 2, 5}]]
    (* OR, a less simple, but more efficient implementation. *)
    A242533[n_, perm_, remain_] := Module[{opt, lr, i, new},
       If[remain == {},
         If[CoprimeQ[First[perm] + Last[perm], First[perm] - Last[perm]],
          ct++];
         Return[ct],
         opt = remain; lr = Length[remain];
         For[i = 1, i <= lr, i++,
          new = First[opt]; opt = Rest[opt];
          If[! CoprimeQ[Last[perm] + new, Last[perm] - new], Continue[]];
          A242533[n, Join[perm, {new}],
           Complement[Range[2, 2 n], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Join[{1}, Table[ct = 0; A242533[n, {1}, Range[2, 2 n]]/2, {n, 2, 6}] ](* Robert Price, Oct 25 2018 *)

Extensions

a(10)-a(11) from Fausto A. C. Cariboni, May 31 2017, Jun 01 2017

A242534 Number of cyclic arrangements of S={1,2,...,n} such that the difference of any two neighbors is not coprime to their sum.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 0, 0, 0, 72, 288, 3600, 17856, 174528, 2540160, 14768640, 101030400, 1458266112, 11316188160, 140951577600, 2659218508800, 30255151463424, 287496736542720, 5064092578713600, 76356431941939200, 987682437203558400, 19323690313219522560
Offset: 1

Views

Author

Stanislav Sykora, May 30 2014

Keywords

Comments

a(n)=NPC(n;S;P) is the count of all neighbor-property cycles for a specific set S of n elements and a specific pair-property P. For more details, see the link and A242519.
Compare this with A242533 where the property is inverted.

Examples

			The first and the last of the 72 cycles for n=10 are:
C_1={1,3,5,10,2,4,8,6,9,7} and C_72={1,7,5,10,8,4,2,6,3,9}.
There are no solutions for cycle lengths from 2 to 9.
		

Crossrefs

Programs

  • Mathematica
    A242534[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, n]]]], 0]/2;
    j1f[x_] := Join[{1}, x, {1}];
    lpf[x_] := Length[Select[cpf[x], ! # &]];
    cpf[x_] := Module[{i},
       Table[! CoprimeQ[x[[i]] - x[[i + 1]], x[[i]] + x[[i + 1]]], {i,
         Length[x] - 1}]];
    Join[{1}, Table[A242534[n], {n, 2, 10}]]
    (* OR, a less simple, but more efficient implementation. *)
    A242534[n_, perm_, remain_] := Module[{opt, lr, i, new},
       If[remain == {},
         If[!
           CoprimeQ[First[perm] + Last[perm], First[perm] - Last[perm]],
          ct++];
         Return[ct],
         opt = remain; lr = Length[remain];
         For[i = 1, i <= lr, i++,
          new = First[opt]; opt = Rest[opt];
          If[CoprimeQ[Last[perm] + new, Last[perm] - new], Continue[]];
          A242534[n, Join[perm, {new}],
           Complement[Range[2, n], perm, {new}]];
          ];
         Return[ct];
         ];
       ];
    Join[{1}, Table[ct = 0; A242534[n, {1}, Range[2, n]]/2, {n, 2, 12}] ](* Robert Price, Oct 25 2018 *)

Extensions

a(19)-a(27) from Hiroaki Yamanouchi, Aug 30 2014

A002816 Number of polygons that can be formed from n points on a circle, no two adjacent.

Original entry on oeis.org

1, 0, 0, 0, 1, 3, 23, 177, 1553, 14963, 157931, 1814453, 22566237, 302267423, 4340478951, 66541218865, 1084982173641, 18752743351339, 342523093859011, 6593167693927885, 133408305489947029, 2831112931136162775, 62878579846490149375, 1458746608689369440265
Offset: 1

Views

Author

Keywords

Comments

Also number of ways of arranging the numbers 1..n in a circle so that adjacent numbers do not differ by 1 mod n. Reversing the direction around the circle does not count as a different solution (cf. A078603).
Also number of ways of seating n people around a circular table so that no one sits next to any of his neighbors in a previous seating order.
Suppose n people are seated at random around a circular table for two meals. Then p(n) = a(n)/((n-1)!/2) is the probability that no two people sit together at both meals.
Number of Hamiltonian cycles in the complement of C_n where C_n is the n-cycle graph. - Andrew Howroyd, Mar 15 2016

Examples

			a(6)=3: 135264, 136425, 142635.
		

References

  • P. Poulet, Reply to Query 4750, Permutations, L'Intermédiaire des Mathématiciens, 26 (1919), 117-121.
  • 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. A000179 (Ménage problem), A078603, A078630, A078631, A242522 (Hamiltonian cycles in complement of path), A006184, left column of A326411.

Programs

  • Maple
    dinner := proc(n) local j,k,sum; sum := (n-1)!/2 + (-1)^n; for k from 1 to n-1 do for j from 1 to min(n-k,k) do sum := sum+(-1)^k*binomial(k-1,j-1)*binomial(n-k,j)*n/(n-k)*(n-k-1)!/2*2^j; od; od; end;
  • Mathematica
    t = {1, 0, 0, 0, 1, 3, 23}; Do[AppendTo[t, ((n^3 - 8*n^2 + 18*n - 21) t[[-1]] + 4*n*(n - 5) t[[-2]] - 2*(n - 6) (n^2 - 5 n + 3) t[[-3]] + (n^2 - 7*n + 9)  t[[-4]] + (n - 5) (n^2 - 5*n + 3) t[[-5]])/(n^2 - 7*n + 9)], {n, 8, 25}]; t (* T. D. Noe, Jan 04 2012 *)
    Join[{1, 0}, RecurrenceTable[{a[3] == 0, a[4] == 0, a[5] == 1, a[6] == 3, a[7] == 23, (n^2 - 7 n + 9) a[n] == (n^3 - 8 n^2 + 18 n - 21) a[n - 1] + 4 n (n - 5) a[n - 2] - 2 (n - 6) (n^2 - 5 n + 3) a[n - 3] + (n^2 - 7 n + 9) a[n - 4] + (n - 5) (n^2 - 5 n + 3) a[n - 5]}, a, {n, 3, 20}]] (* Eric W. Weisstein, Feb 26 2021 *)

Formula

D-finite with recurrence (n^2 - 7n + 9)a(n) = (n^3 - 8n^2 + 18n - 21)a(n - 1) + 4n(n - 5)a(n - 2) - 2(n - 6)(n^2 - 5n + 3)a(n - 3) + (n^2 - 7n + 9)a(n - 4) + (n - 5)(n^2 - 5n + 3)a(n - 5), for n >= 8. - Poulet.
p(n) = exp(-2)*(1 + O(1/n)). - Aspvall and Liang.
Asymptotic: a(n)/(n-1)! ~ 1/(2*e^2)*(1 - 4/n + 20/(3n^3) + 58/(3n^4) + 796/(15n^5) + 7858/(45n^6) + 40324/(63n^7) + 140194/(63n^8) + 2444744/(405n^9) + 40680494/(14175n^10) + ...). - Vaclav Kotesovec, Apr 10 2012

Extensions

Entry improved by Michael Steyer (m.steyer(AT)osram.de), Aug 30 2001
More terms from Sascha Kurz, Mar 22 2002

A189281 Number of permutations p of 1,2,...,n satisfying p(i+2) - p(i) <> 2 for all 1 <= i <= n-2.

Original entry on oeis.org

1, 1, 2, 5, 18, 75, 410, 2729, 20906, 181499, 1763490, 18943701, 222822578, 2847624899, 39282739034, 581701775369, 9202313110506, 154873904848803, 2762800622799362, 52071171437696453, 1033855049655584786, 21567640717569135515
Offset: 0

Views

Author

Vaclav Kotesovec, Apr 19 2011

Keywords

Comments

a(n) is also the number of ways to place n nonattacking pieces rook + semi-leaper (2,2) on an n X n chessboard.
Comments from Vaclav Kotesovec, Mar 05 2022: (Start)
The original submission had keyword hard because of the following running times (in 2012):
a(33) 39 hours
a(34) 78 hours
a(35) 147 hours
The conjectured recurrence would imply the asymptotic expansion for a(n)/n! ~
(1 + 3/n + 2/n^2 + 1/n^3 + 0/n^4 + 3/n^5 + 26/n^6 + 101/n^7 + 124/n^8 - 1409/n^9 - 13266/n^10)/e.
This exactly matches the formula from 2011. In addition, all coefficients are integers. It is highly probable that recurrence is correct.
(End)
There are good reasons to believe the conjecture is correct. (It has the expected form.) The problem is one of counting Hamiltonian cycles in the complement of some simple graph. There is a method for counting these efficiently (although I have not implemented in code). Similar to A242522 / A229430. - Andrew Howroyd, Mar 06 2022
See also Manuel Kauers's comments below. Since the four new terms took weeks of computation, the keyword "hard" continues to be justified. - N. J. A. Sloane, Mar 06 2022
a(40)-a(300) were computed using an independent solution (dynamic programming, O(N^4) per term), and the conjectured recurrence was further confirmed to be correct up to n=300. Consequently, the keyword "hard" is removed. - Rintaro Matsuo, Oct 18 2022

Crossrefs

Formula

Asymptotics: a(n)/n! ~ (1 + 3/n + 2/n^2)/e.
Conjectured recurrence of degree 11 and order 8: (262711*n + 1387742*n^2 - 824875*n^3 - 1855253*n^4 - 111530*n^5 + 680983*n^6 + 364242*n^7 + 84992*n^8 + 10332*n^9 + 640*n^10 + 16*n^11)*a(n) + (-1050844*n - 9705192*n^2 - 7414683*n^3 + 3536494*n^4 + 6459004*n^5 + 3326393*n^6 + 903534*n^7 + 144684*n^8 + 13756*n^9 + 720*n^10 + 16*n^11)*a(n+1) + (3492344 - 2212342*n - 8507169*n^2 - 11544227*n^3 - 12034116*n^4 - 8216995*n^5 - 3442049*n^6 - 890050*n^7 - 142300*n^8 - 13660*n^9 - 720*n^10 - 16*n^11)*a(n+2) + (19817984 + 45323852*n + 825228*n^2 - 57004661*n^3 - 57059306*n^4 - 28077270*n^5 - 8398637*n^6 - 1631510*n^7 - 207980*n^8 - 16828*n^9 - 784*n^10 - 16*n^11)*a(n+3) + (9586160 + 6680237*n - 13772613*n^2 - 27689586*n^3 - 22162455*n^4 - 9855085*n^5 - 2629562*n^6 - 427656*n^7 - 41332*n^8 - 2176*n^9 - 48*n^10)*a(n+4) + (22192864 + 44710768*n - 2924668*n^2 - 52385912*n^3 - 45161616*n^4 - 18784740*n^5 - 4549208*n^6 - 674256*n^7 - 60400*n^8 - 3008*n^9 - 64*n^10)*a(n+5) + (557152 - 2032472*n - 2937392*n^2 - 1594200*n^3 - 517688*n^4 - 122032*n^5 - 19856*n^6 - 1792*n^7 - 64*n^8)*a(n+6) + (3786960 + 7105324*n - 1191064*n^2 - 8059160*n^3 - 5938996*n^4 - 2073752*n^5 - 402736*n^6 - 44528*n^7 - 2624*n^8 - 64*n^9)*a(n+7) + (-598208 - 943004*n + 414196*n^2 + 1213772*n^3 + 728648*n^4 + 203584*n^5 + 29616*n^6 + 2176*n^7 + 64*n^8)*a(n+8) = 0. This recurrence correctly predicted the four new terms in the b-file. - Christoph Koutschan, Feb 19 2022
Comment from N. J. A. Sloane, Mar 12 2022: (Start)
The preceding conjectured recurrence is equivalent to the following, which has degree 3 and order 13, and was obtained by Doron Zeilberger and then reformatted by Manuel Kauers (it uses Mathematica syntax):
Conjecture: ((-1 + n)^2*n*a[n])/4 + (n*(-16 + 38*n + 11*n^2)*a[1 + n])/16 +
(3/2 + (139*n)/16 + (29*n^2)/8 + (3*n^3)/16)*a[2 + n] +
(-21/4 - (51*n)/4 - (79*n^2)/16 - (5*n^3)/8)*a[3 + n] +
(-15/2 - n/8 + (5*n^2)/4 + n^3/8)*a[4 + n] +
(603/4 + (307*n)/4 + (49*n^2)/4 + (11*n^3)/16)*a[5 + n] +
(-41 - (533*n)/16 - (49*n^2)/8 - (5*n^3)/16)*a[6 + n] +
(-911/2 - 161*n - (303*n^2)/16 - (3*n^3)/4)*a[7 + n] +
(-363 - (417*n)/4 - (37*n^2)/4 - n^3/4)*a[8 + n] +
(-993/4 - 53*n - (11*n^2)/4)*a[9 + n] + (-130 - (93*n)/4 - n^2)*a[10 + n] +
(-71/4 - 2*n)*a[11 + n] + (-10 - n)*a[12 + n] + a[13 + n] == 0.
(End)
From Mark van Hoeij, Jul 25 2012: (Start)
A compact way to write the order 13 recurrence is as follows:
Let b(n) = a(n+3) + a(n+2) + (n/2+2)*a(n+1) + (n-1)*a(n)/2
and c(n) = b(n+4) + (n/2+2)*b(n+2) - b(n+1)/2 + (1-n)*b(n)/2;
then c(n+6) - (n+11)*c(n+5) - (2*n+75/4)*c(n+4) + (3-n)*c(n+3)/4 - c(n+2)/2 - (7*n+22)*c(n+1)/4-n*c(n) = 0. (End)

A302734 Number of paths in the n-path complement graph.

Original entry on oeis.org

0, 0, 1, 6, 32, 186, 1245, 9588, 83752, 817980, 8827745, 104277450, 1337781336, 18518728326, 275087536717, 4364152920456, 73637731186160, 1316713607842968, 24869730218182497, 494752411594456110, 10339913354716379440, 226485946787802241650, 5188447062121251600221
Offset: 1

Views

Author

Eric W. Weisstein, Apr 12 2018

Keywords

Crossrefs

Programs

  • Mathematica
    Array[(1/2) Sum[Sum[Sum[(-1)^(k - i) i!*2^j*Binomial[# + i - k, i] Binomial[i, j] Binomial[k - i - 1, k - i - j], {j, 0, k - i}], {i, k}], {k, 2, #}] &, 23] (* Michael De Vlieger, Apr 21 2018 *)
    Table[Sum[(-1)^(k - i) i! 2^j Binomial[n + i - k, i] Binomial[i, j] Binomial[k - i - 1, k - i - j], {k, 2, n}, {i, k}, {j, 0, k - i}]/2, {n, 20}] (* Eric W. Weisstein, Apr 23 2018 *)
  • PARI
    a(n)={sum(k=2, n, sum(i=1, k, sum(j=0, min(i, k-i), (-1)^(k-i)*i!*2^j*binomial(n+i-k, i)*binomial(i, j)*binomial(k-i-1, k-i-j))))/2} \\ Andrew Howroyd, Apr 21 2018

Formula

a(n) = (1/2)*Sum_{k=2..n} Sum_{i=1..k} Sum_{j=0..k-i} (-1)^(k-i)*i!*2^j*binomial(n+i-k, i)*binomial(i, j)*binomial(k-i-1, k-i-j). - Andrew Howroyd, Apr 21 2018
a(n) ~ n! / (2*exp(1)). - Vaclav Kotesovec, Apr 22 2018

Extensions

Terms a(15) and beyond from Andrew Howroyd, Apr 21 2018

A384561 One fourth of the number of permutations of [n] with |p(i+1) - p(i)| >= 2, for i = 1..(n-1) and n appears at position i = 1 or i = n.

Original entry on oeis.org

1, 6, 39, 284, 2337, 21474, 218179, 2430216, 29459301, 386182478, 5444570631, 82157021556, 1321282006249, 22562446559034, 407722012334667, 7773697259015264, 155956589714240109, 3284208113313605286, 72434065593967762831, 1669777527837108720588, 40157785493048522566641
Offset: 5

Views

Author

Wolfdieter Lang, Jun 04 2025

Keywords

Comments

The number of such permutations of [n] is 1 for n = 1 (the p(i) condition is not needed), and 0 for n = 2, 3 and 4, hence a(1) = 1/4 and a(n) = 0 for n = 2, 3 and 4.
The number of permutations of [n] with |p(i+1) - p(i)| >= 2, for i = 1..(n-1), for n >= n is given by A002464(n), for n >= 0. See also A001266(n) = A002464(n)/2, for n >= 2. These permutations are also called king permutations, e.g., in A382644.

Examples

			n = 5: the 4 permutations are 2 4 1 3 5, 3 1 4 2 5 and their reversals 5 3 1 4 2,  5 2 4 1 3.
a(5) = 1 = A382644(4)/2 = (A001236(5) - A242522(6))/2 = (7 - 5)/2, and A382644(5)/2 - A242522(6) = 6 - 5 = 1
a(6) = a(5) + A242522(6) = 1 + 5 = 6.
		

Crossrefs

Formula

a(n) = A382644(n-1)/2, for n >= 5.
a(n) = (A001266(n) - A242522(n+1))/2, for n >= 5.
a(n) = A382644(n)/2 - A242522(n+1), for n >= 5.
a(n) = a(n-1) + A242522(n), for n >= 6, with a(5) = 1.
Previous Showing 11-19 of 19 results.