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
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}.
Cf.
A236602,
A242519,
A242520,
A242521,
A242522,
A242523,
A242524,
A242525,
A242526,
A242527,
A242528,
A242529,
A242531,
A242532,
A242533,
A242534.
-
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 *)
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
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}.
Cf.
A242519,
A242520,
A242521,
A242522,
A242523,
A242524,
A242525,
A242526,
A242527,
A242528,
A242529,
A242530,
A242532,
A242533,
A242534.
-
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 *)
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
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}.
Cf.
A242519,
A242520,
A242521,
A242522,
A242523,
A242524,
A242525,
A242526,
A242527,
A242528,
A242529,
A242530,
A242531,
A242533,
A242534.
-
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 *)
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
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}.
Cf.
A242519,
A242520,
A242521,
A242522,
A242523,
A242524,
A242525,
A242526,
A242527,
A242528,
A242529,
A242530,
A242531,
A242532,
A242534.
-
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 *)
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
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.
Cf.
A242519,
A242520,
A242521,
A242522,
A242523,
A242524,
A242525,
A242526,
A242527,
A242528,
A242529,
A242530,
A242531,
A242532,
A242533.
-
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 *)
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
a(6)=3: 135264, 136425, 142635.
- 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).
- T. D. Noe, Table of n, a(n) for n = 1..100
- B. Aspvall and F. M. Liang, The dinner table problem, Technical Report CS-TR-80-829, Computer Science Department, Stanford, California, 1980.
- D. P. Robbins, The probability that neighbors remain neighbors after random rearrangements, Amer. Math. Monthly 87 (1980), 122-124.
- Eric Weisstein's World of Mathematics, Cycle Complement Graph
- Eric Weisstein's World of Mathematics, Hamiltonian Cycle
- Index entries for sequences related to shoe lacings
-
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;
-
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 *)
Entry improved by Michael Steyer (m.steyer(AT)osram.de), Aug 30 2001
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
- Rintaro Matsuo, Table of n, a(n) for n = 0..300 (terms 0..35 from Vaclav Kotesovec, terms 36..39 from Christoph Koutschan, computed using a parallelization of Kotesovec's Mathematica program)
- Robert Dougherty-Bliss, Experimental Methods in Number Theory and Combinatorics, Ph. D. Dissertation, Rutgers Univ. (2024). See p. 4.
- Manuel Kauers, Comments on the Conjectured Recurrence for A189281.
- Manuel Kauers and Christoph Koutschan, Guessing with Little Data, arXiv:2202.07966 [cs.SC], 2022.
- Vaclav Kotesovec, Non-attacking chess pieces, 6ed, 2013, p. 644.
- Vaclav Kotesovec, Mathematica program for this sequence.
- Rintaro Matsuo, O(n^4) code to calculate a(n)
- George Spahn and Doron Zeilberger, Counting Permutations Where The Difference Between Entries Located r Places Apart Can never be s (For any given positive integers r and s), arXiv:2211.02550 [math.CO], 2022.
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
-
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 *)
-
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
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
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.
Comments