login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A100112
If n is the k-th squarefree number then a(n) = k, otherwise a(n) = 0.
12
1, 2, 3, 0, 4, 5, 6, 0, 0, 7, 8, 0, 9, 10, 11, 0, 12, 0, 13, 0, 14, 15, 16, 0, 0, 17, 0, 0, 18, 19, 20, 0, 21, 22, 23, 0, 24, 25, 26, 0, 27, 28, 29, 0, 0, 30, 31, 0, 0, 0, 32, 0, 33, 0, 34, 0, 35, 36, 37, 0, 38, 39, 0, 0, 40, 41, 42, 0, 43, 44, 45, 0, 46, 47, 0, 0, 48, 49, 50, 0, 0, 51, 52, 0
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) = (A013928(n) + 1)*A008966(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