The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A242520 Number of cyclic arrangements of S={1,2,...,2n} such that the difference between any two neighbors is 3^k for some k=0,1,2,... 17
1, 1, 2, 3, 27, 165, 676, 3584, 19108, 80754, 386776, 1807342, 8218582, 114618650, 1410831012, 12144300991, 126350575684 (list; graph; refs; listen; history; text; internal format)
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.
In this particular instance of NPC(n;S;P), all the terms with odd cycle lengths are necessarily zero.
LINKS
S. Sykora, On Neighbor-Property Cycles, Stan's Library, Volume V, 2014.
EXAMPLE
The two such cycles of length n=6 are:
C_1={1,2,3,6,5,4}, C_2={1,2,5,6,3,4}.
The first and last of the 27 such cycles of length n=10 are:
C_1={1,2,3,4,5,6,7,8,9,10}, C_27={1,4,7,8,5,2,3,6,9,10}.
MATHEMATICA
A242520[n_] := Count[Map[lpf, Map[j1f, Permutations[Range[2, 2 n]]]], 0]/2;
j1f[x_] := Join[{1}, x, {1}];
lpf[x_] := Length[Select[Abs[Differences[x]], ! MemberQ[t, #] &]];
t = Table[3^k, {k, 0, 10}];
Join[{1}, Table[A242520[n], {n, 2, 5}]]
(* OR, a less simple, but more efficient implementation. *)
A242520[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[]];
A242520[n, Join[perm, {new}],
Complement[Range[2, 2 n], perm, {new}]];
];
Return[ct];
];
];
t = Table[3^k, {k, 0, 10}];
Join[{1}, Table[ct = 0; A242520[n, {1}, Range[2, 2 n]]/2, {n, 2, 8}]] (* Robert Price, Oct 22 2018 *)
PROG
(C++) See the link.
CROSSREFS
Sequence in context: A184506 A126203 A126655 * A132533 A059089 A098812
KEYWORD
nonn,hard,more
AUTHOR
Stanislav Sykora, May 27 2014
EXTENSIONS
a(14)-a(17) from Andrew Howroyd, Apr 05 2016
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 May 27 15:55 EDT 2024. Contains 372880 sequences. (Running on oeis4.)