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.

A242523 Number of cyclic arrangements of S={1,2,...,n} such that the difference between any two neighbors is at least 3.

This page as a plain text file.
%I A242523 #17 Oct 24 2018 22:28:03
%S A242523 0,0,0,0,0,0,1,11,125,1351,15330,184846,2382084,32795170,481379278,
%T A242523 7513591430,124363961357,2176990766569,40199252548280,781143277669538,
%U A242523 15937382209774353,340696424417421213,7616192835573406931,177723017354688250713,4321711817908214684734
%N A242523 Number of cyclic arrangements of S={1,2,...,n} such that the difference between any two neighbors is at least 3.
%C A242523 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.
%H A242523 Hiroaki Yamanouchi, <a href="/A242523/b242523.txt">Table of n, a(n) for n = 1..27</a> (terms a(1)-a(15) from _Stanislav Sykora_)
%H A242523 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 A242523 The shortest cycle with this property has length n=7: {1,4,7,3,6,2,5}.
%t A242523 A242523[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, n]]]], 0]/2;
%t A242523 j1f[x_] := Join[{1}, x, {1}];
%t A242523 lpf[x_] := Length[Select[Abs[Differences[x]], # < 3 &]];
%t A242523 Table[A242523[n], {n, 1, 10}]
%t A242523  (* OR, a less simple, but more efficient implementation. *)
%t A242523 A242523[n_, perm_, remain_] := Module[{opt, lr, i, new},
%t A242523    If[remain == {},
%t A242523      If[Abs[First[perm] - Last[perm]] >= 3, ct++];
%t A242523      Return[ct],
%t A242523      opt = remain; lr = Length[remain];
%t A242523      For[i = 1, i <= lr, i++,
%t A242523       new = First[opt]; opt = Rest[opt];
%t A242523       If[Abs[Last[perm] - new] < 3, Continue[]];
%t A242523       A242523[n, Join[perm, {new}],
%t A242523        Complement[Range[2, n], perm, {new}]];
%t A242523       ];
%t A242523      Return[ct];
%t A242523      ];
%t A242523    ];
%t A242523 Table[ct = 0; A242523[n, {1}, Range[2, n]]/2, {n, 1, 11}] (* _Robert Price_, Oct 24 2018 *)
%o A242523 (C++) See the link.
%Y A242523 Cf. A242519, A242520, A242521, A242522, A242524, A242525, A242526, A242527, A242528, A242529, A242530, A242531, A242532, A242533, A242534.
%K A242523 nonn,hard
%O A242523 1,8
%A A242523 _Stanislav Sykora_, May 27 2014
%E A242523 a(16)-a(25) from _Hiroaki Yamanouchi_, Aug 28 2014