close
login
A242533
Number of cyclic arrangements of S={1,2,...,2n} such that the difference of any two neighbors is coprime to their sum.
16
1, 1, 2, 36, 288, 3888, 200448, 4257792, 139511808, 11813990400, 532754620416, 32681097216000, 6107246661427200, 468867166554931200, 27985141759057920000, 13300316016207504998400, 1590032583905141897625600, 118477793127697820024832000
OFFSET
1,3
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).
The cycle must alternate odd/even, so that 2 is not a common factor of sum and difference. Therefore only even lengths are possible. This proves the above conjecture. - Martin Fuller, Mar 12 2026
EXAMPLE
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}.
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 *)
PROG
(C++) See the link.
KEYWORD
nonn,hard,more
AUTHOR
Stanislav Sykora, May 30 2014
EXTENSIONS
a(10)-a(11) from Fausto A. C. Cariboni, May 31 2017, Jun 01 2017
a(12)-a(18) from Martin Fuller, Mar 12 2026
STATUS
approved