OFFSET
1,2
COMMENTS
Perfect powers with first occurrence of h >= 2: 4, 16, 64, 65536, 4096, ... [The perfect power corresponding to h is A175065(h) = 2^A005179(h). - Jianing Song, Oct 27 2024]
FORMULA
EXAMPLE
For n = 11: A001597(11) = 64; there are 4 ways to write 64 as m^k: 64^1 = 8^2 = 4^3 = 2^6.
PROG
(Python)
from math import gcd
from sympy import mobius, integer_nthroot, divisor_count, factorint
def A175064(n):
if n == 1: return 1
def f(x): return int(n-2+x+sum(mobius(k)*(integer_nthroot(x, k)[0]-1) 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 divisor_count(gcd(*factorint(kmax).values())) # Chai Wah Wu, Aug 13 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Jaroslav Krizek, Jan 23 2010
EXTENSIONS
Extended by T. D. Noe, Apr 21 2011
Definition clarified by Jonathan Sondow, Nov 30 2012
STATUS
approved