login
Perfect power but neither square nor cube.
5

%I #34 Nov 08 2024 07:23:55

%S 32,128,243,2048,2187,3125,7776,8192,16807,78125,100000,131072,161051,

%T 177147,248832,279936,371293,524288,537824,759375,823543,1419857,

%U 1594323,1889568,2476099,3200000,4084101,5153632,6436343,7962624,8388608,10000000,11881376,17210368

%N Perfect power but neither square nor cube.

%H Reinhard Zumkeller, <a href="/A239728/b239728.txt">Table of n, a(n) for n = 1..1000</a>

%F GCD(A052409(a(n)), 6) = 1. - _Reinhard Zumkeller_, Mar 28 2014

%F Sum_{n>=1} 1/a(n) = 1 - zeta(2) - zeta(3) + zeta(6) + Sum_{k>=2} mu(k)*(1-zeta(k)) = 0.0448164603... - _Amiram Eldar_, Dec 21 2020

%e 279936 is included since 279936 = 6^7 is a power and this is not a square or a cube.

%e 59049 = 9^5 not included since this is a square 243^2 = 59049.

%e 32768 = 8^5 not included since this is a cube 32^3 = 32768.

%o (PARI) for(i=1, 2^25, if(gcd(ispower(i), 6) == 1, print(i)))

%o (Haskell)

%o import Data.Map (singleton, findMin, deleteMin, insert)

%o a239728 n = a239728_list !! (n-1)

%o a239728_list = f 9 (3, 2) (singleton 4 (2, 2)) where

%o f zz (bz, be) m

%o | xx < zz && gcd 6 be > 1 =

%o f zz (bz, be+1) (insert (bx*xx) (bx, be+1) $ deleteMin m)

%o | xx < zz = xx :

%o f zz (bz, be+1) (insert (bx*xx) (bx, be+1) $ deleteMin m)

%o | xx > zz = f (zz+2*bz+1) (bz+1, 2) (insert (bz*zz) (bz, 3) m)

%o | otherwise = f (zz + 2 * bz + 1) (bz + 1, 2) m

%o where (xx, (bx, be)) = findMin m

%o -- _Reinhard Zumkeller_, Mar 28 2014

%o (Python)

%o from sympy import mobius, integer_nthroot

%o def A239728(n):

%o def f(x): return int(n+x-integer_nthroot(x,5)[0]+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(7,x.bit_length())))

%o kmin, kmax = 1,2

%o while f(kmax) >= kmax:

%o kmax <<= 1

%o while True:

%o kmid = kmax+kmin>>1

%o if f(kmid) < kmid:

%o kmax = kmid

%o else:

%o kmin = kmid

%o if kmax-kmin <= 1:

%o break

%o return kmax # _Chai Wah Wu_, Aug 14 2024

%Y Cf. A001597 (perfect powers), A097054 (nonsquare perfect powers), A239870 (noncube perfect powers).

%Y Cf. A008683, A052409.

%K nonn,easy,changed

%O 1,1

%A _Jeppe Stig Nielsen_, Mar 25 2014