A051252 Number of essentially different ways of arranging numbers 1 through 2n around a circle so that sum of each pair of adjacent numbers is prime.
1, 1, 1, 2, 48, 512, 1440, 40512, 385072, 3154650, 106906168, 3197817022, 82924866213, 4025168862425, 127854811616691
Offset: 1
Examples
One arrangement for 2n=6 is 1,4,3,2,5,6 and this is essentially unique, so a(3)=1.
References
- R. K. Guy, Unsolved Problems in Number Theory, second edition, Springer, 1994. See section C1.
Links
- S. Sykora, On Neighbor-Property Cycles, Stan's Library, Volume V, 2014.
- Eric Weisstein's World of Mathematics, Prime Circle.
Crossrefs
Programs
-
Mathematica
$RecursionLimit=500; try[lev_] := Module[{t, j}, If[lev>2n, (*then make sure the sum of the first and last is prime*) If[PrimeQ[soln[[1]]+soln[[2n]]]&&soln[[2]]<=soln[[2n]], (*Print[soln]; *) cnt++ ], (*else append another number to the soln list*) t=soln[[lev-1]]; For[j=1, j<=Length[s[[t]]], j++, If[ !MemberQ[soln, s[[t]][[j]]], soln[[lev]]=s[[t]][[j]]; try[lev+1]; soln[[lev]]=0]]]]; For[lst={}; n=1, n<=7, n++, s=Table[{}, {2n}]; For[i=1, i<=2n, i++, For[j=1, j<=2n, j++, If[i!=j&&PrimeQ[i+j], AppendTo[s[[i]], j]]]]; soln=Table[0, {2n}]; soln[[1]]=1; cnt=0; try[2]; AppendTo[lst, cnt]]; lst (* T. D. Noe *)
Extensions
a(14)-a(15) from Max Alekseyev, Sep 19 2013
Comments