login
A071404
Which nonsquarefree number is a square number? a(n)-th nonsquarefree number equals n^2, the n-th square.
2
1, 3, 5, 9, 13, 18, 25, 31, 39, 46, 55, 66, 76, 86, 99, 112, 125, 142, 157, 172, 187, 206, 225, 244, 264, 285, 307, 328, 353, 377, 400, 429, 453, 480, 507, 534, 562, 593, 623, 656, 691, 725, 762, 795, 831, 867, 904, 941, 977, 1019, 1059, 1101, 1145, 1185, 1226
OFFSET
2,2
LINKS
FORMULA
A013929(a(n)) = A000290(n) = n^2.
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