Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #17 Jun 12 2018 14:37:26
%S 1,2,2,2,2,8,2,2,2,8,2,16,2,8,8,2,2,16,2,16,8,8,2,28,2,8,2,16,2,144,2,
%T 2,8,8,8,40,2,8,8,28,2,144,2,16,16,8,2,44,2,16,8,16,2,28,8,28,8,8,2,
%U 1168,2,8,16,2,8,144,2,16,8,144,2,124,2,8,16,16,8,144
%N Let d_1, d_2, d_3, ..., d_tau(n) be the divisors of n; a(n) = number of permutations p of d_1, d_2, d_3, ..., d_tau(n) such that p_(i+1)/p_i is a prime or 1/prime for i = 1,2,...,tau(n)-1.
%H Alois P. Heinz, <a href="/A295557/b295557.txt">Table of n, a(n) for n = 1..359</a>
%p with(numtheory):
%p q:= (i, j)-> is(i/j, integer) and isprime(i/j):
%p b:= proc(s, l) option remember; `if`(s={}, 1, add(
%p `if`(q(l, j) or q(j, l), b(s minus{j}, j), 0), j=s))
%p end:
%p a:= n-> ((s-> add(b(s minus {j}, j), j=s))(divisors(n))):
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Nov 26 2017
%t q[i_, j_] := PrimeQ[i/j];
%t b[s_, l_] := b[s, l] = If[s == {}, 1, Sum[If[q[l, j] || q[j, l], b[s ~Complement~ {j}, j], 0], {j, s}]];
%t a[n_] := Function[s, Sum[b[s ~Complement~ {j}, j], {j, s}]][Divisors[n]];
%t Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jun 12 2018, after _Alois P. Heinz_ *)
%Y See A173675 and A179926 for other versions.
%K nonn
%O 1,2
%A _David A. Corneth_ and _N. J. A. Sloane_, Nov 26 2017