%I #68 Feb 16 2025 08:33:01
%S 1,4,14,54,185,619,2027,6553,21044,67231,214122,680330,2158391,
%T 6840384,21663503,68575557,217004842,686552743,2171766332,6869227848,
%U 21725636644,68709456167,217293374285,687174291753,2173105517385,6872112993377,21731852479862,68722847672629,217322225558934,687236449779456,2173239433013146
%N Number of powerful numbers <= 10^n.
%C These numbers agree with the asymptotic formula c*sqrt(x), with c=2.1732...(A090699). - _T. D. Noe_, May 09 2006
%C Bateman & Grosswald proved that the number of powerful numbers up to x is zeta(3/2)/zeta(3) * x^1/2 + zeta(2/3)/zeta(2) * x^1/3 + o(x^1/6). This approximates the series very closely: up to a(24), all absolute errors are less than 75. - _Charles R Greathouse IV_, Sep 23 2008
%H Charles R Greathouse IV and Hiroaki Yamanouchi, <a href="/A118896/b118896.txt">Table of n, a(n) for n = 0..45</a> (terms a(0)-a(32) from Charles R Greathouse IV)
%H Michael Filaseta and Ognian Trifonov, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa67/aa6743.pdf">The distribution of squarefull numbers in short intervals</a>, Acta Arithmetica 67 (1994), pp. 323-333.
%H Paul T. Bateman and Emil Grosswald, <a href="http://projecteuclid.org/euclid.ijm/1255380836">On a theorem of Erdős and Szekeres</a>, Illinois J. Math. 2:1 (1958), p. 88-98.
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PowerfulNumber.html">Powerful Number</a>
%F Pi(x) = Sum_{i=1..x^(1/3)} floor(sqrt(x/i^3)) only if i is squarefree. - _Robert G. Wilson v_, Aug 12 2014
%p f:= m -> nops({seq(seq(a^2*b^3, b=1..floor((m/a^2)^(1/3))),a=1..floor(sqrt(m)))}):
%p seq(f(10^n),n=0..10); # _Robert Israel_, Aug 12 2014
%t f[n_] := Block[{max = 10^n}, Length@ Union@ Flatten@ Table[ a^2*b^3, {b, max^(1/3)}, {a, Sqrt[ max/b^3]}]]; Array[f, 13, 0] (* _Robert G. Wilson v_, Aug 11 2014 *)
%t powerfulNumberPi[n_] := Sum[ If[ SquareFreeQ@ i, Floor[ Sqrt[ n/i^3]], 0], {i, n^(1/3)}]; Array[ powerfulNumberPi[10^#] &, 27, 0] (* _Robert G. Wilson v_, Aug 12 2014 *)
%o (PARI) a(n)=n=10^n;sum(k=1, floor((n+.5)^(1/3)), if(issquarefree(k), sqrtint(n\k^3))) \\ _Charles R Greathouse IV_, Sep 23 2008
%o (Python)
%o from math import isqrt
%o from sympy import integer_nthroot, factorint
%o def A118896(n):
%o m = 10**n
%o return sum(isqrt(m//x**3) for x in range(1,integer_nthroot(m,3)[0]+1) if max(factorint(x).values(),default=0)<=1) # _Chai Wah Wu_, May 13 2023
%o (Python)
%o # faster program
%o def A118896(n):
%o def squarefreepi(n): return int(sum(mobius(k)*(n//k**2) for k in range(1, isqrt(n)+1)))
%o m, c, l = 10**n, 0, 0
%o j = isqrt(m)
%o while j>1:
%o k2 = integer_nthroot(m//j**2,3)[0]+1
%o w = squarefreepi(k2-1)
%o c += j*(w-l)
%o l, j = w, isqrt(m//k2**3)
%o c += squarefreepi(integer_nthroot(m,3)[0])-l
%o return c # _Chai Wah Wu_, Sep 09 2024
%Y Cf. A001694, A090699.
%K nonn,changed
%O 0,2
%A _Eric W. Weisstein_, May 05 2006
%E More terms from _T. D. Noe_, May 09 2006
%E a(13)-a(24) from _Charles R Greathouse IV_, Sep 23 2008
%E a(25)-a(29) from _Charles R Greathouse IV_, May 30 2011
%E a(30) from _Charles R Greathouse IV_, May 31 2011