OFFSET
1,2
COMMENTS
a(n) = n*A086595(n).
EXAMPLE
a(4)=8 because we have 1234, 1432, 2143, 2341, 3214, 3412, 4123 and 4321.
MAPLE
with(combinat): for n from 1 to 7 do P:=permute(n): ct:=0: for j from 1 to n! do if add(gcd(P[j][i+1], P[j][i]), i=1..n-1)=n-1 and gcd(P[j][1], P[j][n])=1 then ct:=ct+1 else ct:=ct fi od: a[n]:=ct: od: seq(a[n], n=1..7);
MATHEMATICA
{1}~Join~Array[Count[Permutations@ Range@ #, w_ /; AllTrue[Map[ RotateLeft[w, #][[1 ;; 2]] &, w], CoprimeQ @@ # &]] &, 8, 2] (* Michael De Vlieger, Sep 25 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch (in collaboration with Ray Chandler, Vladeta Jovovic, Leroy Quet, Zak Seidov, and Joshua Zucker), Apr 09 2005
EXTENSIONS
a(15) and a(16) from Ray Chandler and Joshua Zucker, Apr 12 2005
a(17)-a(24) from Max Alekseyev, Jun 13 2005
a(25)-a(26) (using A086595) from Alois P. Heinz, May 05 2023
STATUS
approved