OFFSET
1,2
COMMENTS
Although 1 is a square, is a cube, and so on..., 1 is sometimes excluded from perfect powers since it is not a well-defined power of 1 (1 = 1^k for any k in [2, 3, 4, 5, ...])
LINKS
Daniel Forgues, Table of n, a(n) for n=1..8649
PROG
(PARI) isok(n) = if (n == 1, return (1), return (ispower(n, , &np) && (! isprime(np)))); \\ Michel Marcus, Jun 12 2013
(Python)
from sympy import mobius, integer_nthroot, primepi
def A131605(n):
def f(x): return int(n-2+x+sum(mobius(k)*((a:=integer_nthroot(x, k)[0])-1)+primepi(a) for k in range(2, x.bit_length())))
kmin, kmax = 1, 2
while f(kmax) >= kmax:
kmax <<= 1
while True:
kmid = kmax+kmin>>1
if f(kmid) < kmid:
kmax = kmid
else:
kmin = kmid
if kmax-kmin <= 1:
break
return kmax # Chai Wah Wu, Aug 14 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Daniel Forgues, May 27 2008
EXTENSIONS
Klaus Brockhaus previously provided a table of n, a(n) for n=1..1323, May 28 2008
STATUS
approved