The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A242531 Number of cyclic arrangements of S={1,2,...,n} such that the difference of any two neighbors is a divisor of their sum. 16
 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 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,6 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. LINKS S. Sykora, On Neighbor-Property Cycles, Stan's Library, Volume V, 2014. EXAMPLE 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}. 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 *) PROG (C++) See the link. CROSSREFS Cf. A242519, A242520, A242521, A242522, A242523, A242524, A242525, A242526, A242527, A242528, A242529, A242530, A242532, A242533, A242534. Sequence in context: A103218 A319311 A107381 * A275160 A132192 A147756 Adjacent sequences:  A242528 A242529 A242530 * A242532 A242533 A242534 KEYWORD nonn,hard,more AUTHOR Stanislav Sykora, May 30 2014 EXTENSIONS a(24)-a(28) from Fausto A. C. Cariboni, May 25 2017 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified February 19 09:33 EST 2020. Contains 332041 sequences. (Running on oeis4.)