OFFSET
1,6
COMMENTS
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000
FORMULA
a(p) = a(p^2) = 1 for prime p.
If n>4, then a(n) = A056789(n) - n * Sum_{k=1..floor(n/2)} floor(n/(gcd(n,k)^2)). For proof, just rewrite "mod" in terms of the floor-function, use the formulas lcm(n,k)*gcd(n,k) = n*k and gcd(n, k) = gcd(n, n-k) and split the sum into two equal parts.
If p is a prime and p>2, then a(2*p) = A339384(2*p) = 3 + p*(p-1)/2.
MAPLE
a:= n-> add(irem(n*k/igcd(n, k)^2, k), k=1..n):
seq(a(n), n=1..80); # Alois P. Heinz, Dec 03 2020
MATHEMATICA
Table[Sum[Mod[LCM[n, k]/GCD[n, k], k], {k, n}], {n, 67}] (* Stefano Spezia, Dec 02 2020 *)
PROG
(PARI) a(n) = sum(k=1, n, n*k/gcd(n, k)^2 % k); \\ Michel Marcus, Dec 09 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Sebastian Karlsson, Dec 02 2020
EXTENSIONS
More terms from Stefano Spezia, Dec 02 2020
STATUS
approved