OFFSET
2,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 2..10001
FORMULA
a(n) = kn^2 + O(n), where k = 1 - 6/Pi^2. - Charles R Greathouse IV, Sep 13 2013
a(n) = -Sum_{k=2..n} mu(k)*floor((n/k)^2). - Chai Wah Wu, Jul 20 2024
EXAMPLE
The first, 3rd, 5th, 9th, and 13th nonsquarefree numbers are 4, 9, 16, 25, and 36, respectively.
MATHEMATICA
Position[Select[Range[3200], !SquareFreeQ[#] &], _?(IntegerQ[Sqrt[#]] &)][[;; , 1]] (* Amiram Eldar, Mar 04 2024 *)
PROG
(PARI) lista(nn) = {sqfs = select(n->(1-issquarefree(n)), vector(nn, i, i)); for (i = 1, #sqfs, if (issquare(sqfs[i]), print1(i, ", ")); ); } \\ Michel Marcus, Sep 12 2013
(PARI) a(n)=n^2-sum(k=1, n, n^2\k^2*moebius(k)) \\ Charles R Greathouse IV, Sep 13 2013
(Python)
from sympy import mobius
def A071404(n): return -sum(mobius(k)*(n**2//k**2) for k in range(2, n+1)) # Chai Wah Wu, Jul 20 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, May 24 2002
EXTENSIONS
Offset changed by Charles R Greathouse IV, Sep 13 2013
STATUS
approved