login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A242519 Number of cyclic arrangements of S={1,2,...,n} such that the difference between any two neighbors is 2^k for some k=0,1,2,... 18
0, 1, 1, 1, 4, 8, 14, 32, 142, 426, 1204, 3747, 9374, 26306, 77700, 219877, 1169656, 4736264, 17360564, 69631372, 242754286, 891384309, 3412857926, 12836957200, 42721475348, 152125749587, 549831594988 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
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. Evaluating this sequence for n>=3 is equivalent to counting Hamiltonian cycles in a pair-property graph with n vertices and is often quite hard. For more details, see the link.
LINKS
Hiroaki Yamanouchi, Table of n, a(n) for n = 1..27 (first 21 terms from Stanislav Sykora)
S. Sykora, On Neighbor-Property Cycles, Stan's Library, Volume V, 2014.
FORMULA
For any S and any P, and for n>=3, NPC(n;S;P)<=A001710(n-1).
EXAMPLE
The four such cycles of length 5 are:
C_1={1,2,3,4,5}, C_2={1,2,4,3,5}, C_3={1,2,4,5,3}, C_4={1,3,2,4,5}.
The first and the last of the 426 such cycles of length 10 are:
C_1={1,2,3,4,5,6,7,8,10,9}, C_426={1,5,7,8,6,4,3,2,10,9}.
MATHEMATICA
A242519[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, n]]]], 0]/2;
j1f[x_] := Join[{1}, x, {1}];
lpf[x_] := Length[Select[Abs[Differences[x]], ! MemberQ[t, #] &]];
t = Table[2^k, {k, 0, 10}];
Join[{0, 1}, Table[A242519[n], {n, 3, 10}]]
(* OR, a less simple, but more efficient implementation. *)
A242519[n_, perm_, remain_] := Module[{opt, lr, i, new},
If[remain == {},
If[MemberQ[t, Abs[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[! MemberQ[t, Abs[Last[perm] - new]], Continue[]];
A242519[n, Join[perm, {new}],
Complement[Range[2, n], perm, {new}]];
];
Return[ct];
];
];
t = Table[2^k, {k, 0, 10}];
Join[{0, 1}, Table[ct = 0; A242519[n, {1}, Range[2, n]]/2, {n, 3, 12}]] (* Robert Price, Oct 22 2018 *)
PROG
(C++) See the link.
CROSSREFS
Sequence in context: A124743 A188575 A324585 * A174554 A360527 A272048
KEYWORD
nonn,hard
AUTHOR
Stanislav Sykora, May 27 2014
EXTENSIONS
a(22)-a(27) from Hiroaki Yamanouchi, Aug 29 2014
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 03:03 EDT 2024. Contains 371917 sequences. (Running on oeis4.)