OFFSET
2,1
COMMENTS
a(n) is the number of 4-tuples [a,b,c,d] of integers in [0,1,...,n-1] such that a*b-c*d, a*c-b*d and a*d-b*c are all coprime to n.
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
FORMULA
Multiplicative with a(p^k) = p^(4*(k-1)) * (p^4 - 3*p^3 + 9*p^2 - 17*p + 10) for primes p.
Sum_{k=1..n} a(k) ~ c * n^5 / 5, where c = Product_{p prime} (1 - 3/p^2 + 9/p^3 - 17/p^4 + 10/p^5) = 0.42729799106430918317... . - Amiram Eldar, Jan 20 2024
EXAMPLE
a(3) = 40 because the 4-tuples [0, 1, 1, 1], [0, 1, 1, 2], [1, 1, 1, 2], [0, 1, 2, 2], [0, 2, 2, 2], [1, 2, 2, 2] and their permutations satisfy the criterion for n = 4. Of these, [0,1,1,2] and [0,1,2,2] each have 12 permutations and the others have 4, so a(3) = 2 * 12 + 4 * 4 = 40.
MAPLE
filter:= proc(L, n)
andmap(t -> igcd(t, n)=1, {L[1]*L[2]-L[3]*L[4], L[1]*L[3]-L[2]*L[4], L[1]*L[4]-L[2]*L[3]})
end proc:
g:= proc(n) local a, b, c, d, t; option remember;
t:= 0;
for a from 0 to n-1 do
for b from 0 to a do
for c from 0 to b do
for d from 0 to c do
if filter([a, b, c, d], n) then t:= t + combinat:-numbperm([a, b, c, d]) fi
od od od od;
t
end proc:
f:= proc(n) local F, t;
F:= ifactors(n)[2];
mul(g(t[1]^t[2]), t=F)
end proc:
map(f, [$2..50]);
MATHEMATICA
f[p_, e_] := p^(4*(e - 1))*(p^4 - 3*p^3 + 9*p^2 - 17*p + 10); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100, 2] (* Amiram Eldar, Jan 20 2024 *)
PROG
(PARI) a(n) = {my(f = factor(n)); prod(i = 1, #f~, p=f[i, 1]; e=f[i, 2]; p^(4*(e-1)) * (p^4 - 3*p^3 + 9*p^2 - 17*p + 10)); } \\ Amiram Eldar, Jan 20 2024
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Robert Israel, Dec 05 2023
STATUS
approved