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.
%I A102381 #24 May 05 2023 09:25:46 %S A102381 1,2,6,8,60,24,504,576,6480,5760,242352,93312,6200064,5612544, %T A102381 95294880,136249344,13687492608,5022425088,693149184000,472559616000, %U A102381 18501259714560,23441203298304,4435759798272000,1568692666368000,262234601210880000,317576826394214400 %N A102381 Number of permutations of 1..n in which every pair of adjacent numbers as well as the first and the last entries are relatively prime. %C A102381 a(n) = n*A086595(n). %e A102381 a(4)=8 because we have 1234, 1432, 2143, 2341, 3214, 3412, 4123 and 4321. %p A102381 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); %t A102381 {1}~Join~Array[Count[Permutations@ Range@ #, w_ /; AllTrue[Map[ RotateLeft[w, #][[1 ;; 2]] &, w], CoprimeQ @@ # &]] &, 8, 2] (* _Michael De Vlieger_, Sep 25 2017 *) %Y A102381 Cf. A086595, A076220. %K A102381 nonn %O A102381 1,2 %A A102381 _Emeric Deutsch_ (in collaboration with _Ray Chandler_, _Vladeta Jovovic_, _Leroy Quet_, _Zak Seidov_, and _Joshua Zucker_), Apr 09 2005 %E A102381 a(15) and a(16) from _Ray Chandler_ and _Joshua Zucker_, Apr 12 2005 %E A102381 a(17)-a(24) from _Max Alekseyev_, Jun 13 2005 %E A102381 a(25)-a(26) (using A086595) from _Alois P. Heinz_, May 05 2023