OFFSET
1,2
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Squarefree
FORMULA
a(A005117(n)) = n;
a(n) = Sum_{k=1..n} mu(lcm(n,k))^2. - Benoit Cloitre, Jun 14 2007
MATHEMATICA
a[n_] := Sum[MoebiusMu[LCM[n, k]]^2, {k, 1, n}];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Nov 18 2021, after Benoit Cloitre *)
PROG
(PARI) a(n)=sum(k=1, n, moebius(lcm(n, k))^2) \\ Benoit Cloitre, Jun 14 2007
(PARI) first(n)=my(v=vector(n), k); forsquarefree(m=1, n, v[m[1]]=k++); v \\ Charles R Greathouse IV, Jan 08 2018
(Python)
from sympy import integer_nthroot, mobius
def A100112(n):
b = 0
k, r = integer_nthroot(n, 2)
a, c = (mobius(k), k-1) if r else (0, k)
for i in range(1, c+1):
m, j = mobius(i), i**2
a += m*(n//j)
b += m*((n-1)//j)
return a if a>b else 0 # Chai Wah Wu, May 11 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Nov 07 2004
STATUS
approved