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”).
%I #35 Jul 21 2024 03:34:30
%S 1,3,5,9,13,18,25,31,39,46,55,66,76,86,99,112,125,142,157,172,187,206,
%T 225,244,264,285,307,328,353,377,400,429,453,480,507,534,562,593,623,
%U 656,691,725,762,795,831,867,904,941,977,1019,1059,1101,1145,1185,1226
%N Which nonsquarefree number is a square number? a(n)-th nonsquarefree number equals n^2, the n-th square.
%H Amiram Eldar, <a href="/A071404/b071404.txt">Table of n, a(n) for n = 2..10001</a>
%F A013929(a(n)) = A000290(n) = n^2.
%F a(n) = kn^2 + O(n), where k = 1 - 6/Pi^2. - _Charles R Greathouse IV_, Sep 13 2013
%F a(n) = -Sum_{k=2..n} mu(k)*floor((n/k)^2). - _Chai Wah Wu_, Jul 20 2024
%e The first, 3rd, 5th, 9th, and 13th nonsquarefree numbers are 4, 9, 16, 25, and 36, respectively.
%t Position[Select[Range[3200], !SquareFreeQ[#] &], _?(IntegerQ[Sqrt[#]] &)][[;; , 1]] (* _Amiram Eldar_, Mar 04 2024 *)
%o (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
%o (PARI) a(n)=n^2-sum(k=1, n, n^2\k^2*moebius(k)) \\ _Charles R Greathouse IV_, Sep 13 2013
%o (Python)
%o from sympy import mobius
%o def A071404(n): return -sum(mobius(k)*(n**2//k**2) for k in range(2,n+1)) # _Chai Wah Wu_, Jul 20 2024
%Y Cf. A005117, A013929, A000040, A000290, A071403.
%K nonn
%O 2,2
%A _Labos Elemer_, May 24 2002
%E Offset changed by _Charles R Greathouse IV_, Sep 13 2013