OFFSET
1,3
COMMENTS
a(n) is also the number of permutations of 2..n such that every two adjacent numbers are relatively prime.
FORMULA
For prime p, a(p)=A076220(p-1). - Max Alekseyev, Jun 13 2005
EXAMPLE
a(6) = 4 since there are 4 ways to arrange 1,2,3,4,5,6 in a circle such that every two adjacent numbers are relatively prime: 1-2-3-4-5-6-1, 1-4-3-2-5-6-1, 1-6-5-2-3-4-1, 1-6-5-4-3-2-1.
PROG
(PARI) { A086595(n) = my(d, A, r, M); A=matrix(n, n, i, j, gcd(i, j)==1); r=0; forstep(s=1, 2^n-1, 2, M=vecextract(A, s, s)^n; d=matsize(M)[1]; r+=(-1)^(n-d)*M[1, 1]); r } /* Max Alekseyev, Jun 13 2005 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Lior Manor, Jul 23 2003
EXTENSIONS
a(15) and a(16) from Ray Chandler and Joshua Zucker, Apr 10 2005
a(17)-a(29) from Max Alekseyev, Jun 13 2005, Jul 05 2014
STATUS
approved