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.
%I A242532 #20 Oct 25 2018 21:25:43 %S A242532 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, %T A242532 44370,0,0,0,0,2032951,8840796,12791922,101519154,0,0 %N 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. %C A242532 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. %C A242532 For this property P and sets {0,1,2,...,n-1} or {1,2,...,n} the problem does not appear to have any solution. %C A242532 a(40)=a(41)=a(42)=a(43)=a(46)=a(47)=0. - _Fausto A. C. Cariboni_, May 17 2017 %H A242532 S. Sykora, <a href="http://dx.doi.org/10.3247/SL5Math14.002">On Neighbor-Property Cycles</a>, <a href="http://ebyte.it/library/Library.html#math">Stan's Library</a>, Volume V, 2014. %e A242532 The shortest such cycle is of length n=9: {2,4,8,10,5,7,9,3,6}. %e A242532 The next a(n)>0 occurs for n=14 and has 20 solutions. %e A242532 The first and the last of these are: %e A242532 C_1={2,4,8,10,5,7,14,12,15,13,11,9,3,6}, %e A242532 C_2={2,4,12,15,13,11,9,3,5,7,14,10,8,6}. %t A242532 A242532[n_] := Count[Map[lpf, Map[j2f, Permutations[Range[3, n + 1]]]], 0]/2; %t A242532 j2f[x_] := Join[{2}, x, {2}]; %t A242532 dvf[x_] := Module[{i}, %t A242532 Table[Abs[x[[i]] - x[[i + 1]]] > 1 && %t A242532 Divisible[x[[i]] + x[[i + 1]], x[[i]] - x[[i + 1]]], {i, %t A242532 Length[x] - 1}]]; %t A242532 lpf[x_] := Length[Select[dvf[x], ! # &]]; %t A242532 Table[A242532[n], {n, 1, 10}] %t A242532 (* OR, a less simple, but more efficient implementation. *) %t A242532 A242532[n_, perm_, remain_] := Module[{opt, lr, i, new}, %t A242532 If[remain == {}, %t A242532 If[Abs[First[perm] - Last[perm]] > 1 && %t A242532 Divisible[First[perm] + Last[perm], First[perm] - Last[perm]], %t A242532 ct++]; %t A242532 Return[ct], %t A242532 opt = remain; lr = Length[remain]; %t A242532 For[i = 1, i <= lr, i++, %t A242532 new = First[opt]; opt = Rest[opt]; %t A242532 If[Abs[Last[perm] - new] <= 1 || ! %t A242532 Divisible[Last[perm] + new, Last[perm] - new], Continue[]]; %t A242532 A242532[n, Join[perm, {new}], %t A242532 Complement[Range[3, n + 1], perm, {new}]]; %t A242532 ]; %t A242532 Return[ct]; %t A242532 ]; %t A242532 ]; %t A242532 Table[ct = 0; A242532[n, {2}, Range[3, n + 1]]/2, {n, 1, 15}] (* _Robert Price_, Oct 25 2018 *) %o A242532 (C++) See the link. %Y A242532 Cf. A242519, A242520, A242521, A242522, A242523, A242524, A242525, A242526, A242527, A242528, A242529, A242530, A242531, A242533, A242534. %K A242532 nonn,hard,more %O A242532 1,14 %A A242532 _Stanislav Sykora_, May 30 2014 %E A242532 a(29)-a(37) from _Fausto A. C. Cariboni_, May 17 2017