OFFSET
1,3
COMMENTS
LINKS
FORMULA
EXAMPLE
There are 14 perfect powers less than 1000 which are not prime powers:
6^2, 10^2, 12^2, 14^2, 6^3, 15^2, 18^2, 20^2, 21^2, 22^2, 24^2, 26^2, 28^2, 30^2.
PROG
(SageMath)
def A365670(n):
gen = (p for p in srange(2, 10^n)
if p.is_perfect_power() and not p.is_prime_power())
return sum(1 for _ in gen)
print([A365670(n) for n in range(1, 7)])
(Python)
from sympy import mobius, integer_nthroot, primepi
def A365670(n): return int(sum(mobius(x)*(1-(a:=integer_nthroot(10**n, x)[0]))-primepi(a) for x in range(2, (10**n).bit_length())))-1 if n>1 else n-1 # Chai Wah Wu, Aug 14 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Sep 16 2023
STATUS
approved