# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a253642 Showing 1-1 of 1 %I A253642 #17 Aug 14 2024 01:50:53 %S A253642 0,1,1,1,2,1,1,1,1,1,3,2,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,2,1,1,2, %T A253642 1,3,1,1,1,1,1,3,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1, %U A253642 1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1 %N A253642 Number of ways the perfect power A001597(n) can be written as a^b, with a, b > 1. %C A253642 Run lengths of A072103. Also, the terms a(n) which exceed 1 constitute A175066. - _Andrey Zabolotskiy_, Aug 17 2016 %F A253642 a(n) = A000005(A253641(A001597(n))) - 1. %F A253642 a(n) = A175064(n) - 1. %e A253642 a(1)=0 since A001597(1)=1 can be written as a^b for a=1 and any b, but not using a base a > 1. %e A253642 a(2)=a(3)=a(4)=1 since the following terms 4=2^2, 8=2^3 and 9=3^2 can be written as perfect powers in only one way. %e A253642 a(5)=2 since A001597(5)=16=a^b for (a,b)=(2,4) and (4,2). %o A253642 (PARI) for(n=1,9999,(e=ispower(n))&&print1(numdiv(e)-1,",")) %o A253642 (Python) %o A253642 from math import gcd %o A253642 from sympy import mobius, integer_nthroot, divisor_count, factorint %o A253642 def A253642(n): %o A253642 if n == 1: return 0 %o A253642 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()))) %o A253642 kmin, kmax = 1,2 %o A253642 while f(kmax) >= kmax: %o A253642 kmax <<= 1 %o A253642 while True: %o A253642 kmid = kmax+kmin>>1 %o A253642 if f(kmid) < kmid: %o A253642 kmax = kmid %o A253642 else: %o A253642 kmin = kmid %o A253642 if kmax-kmin <= 1: %o A253642 break %o A253642 return divisor_count(gcd(*factorint(kmax).values()))-1 # _Chai Wah Wu_, Aug 13 2024 %Y A253642 Cf. A001597, A072103, A175064, A253641. %K A253642 nonn %O A253642 1,5 %A A253642 _M. F. Hasler_, Jan 25 2015 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE