%I #36 Aug 16 2024 04:48:05
%S 8,27,32,125,128,216,243,343,512,1000,1331,1728,2048,2187,2197,2744,
%T 3125,3375,4913,5832,6859,7776,8000,8192,9261,10648,12167,13824,16807,
%U 17576,19683,21952,24389,27000,29791,32768,35937,39304,42875,50653
%N Nonsquare perfect powers.
%C Terms of A001597 that are not in A000290.
%C All terms of this sequence are also in A070265 (odd powers), but omitting those odd powers that are also a square (e.g. 64=4^3=8^2).
%H Reinhard Zumkeller, <a href="/A097054/b097054.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PerfectPower.html">Perfect Power</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/OddPower.html">Odd Power</a>.
%F A052409(a(n)) is odd. - _Reinhard Zumkeller_, Mar 28 2014
%F Sum_{n>=1} 1/a(n) = 1 - zeta(2) + Sum_{k>=2} mu(k)*(1-zeta(k)) = 0.2295303015... - _Amiram Eldar_, Dec 21 2020
%p # uses code of A001597
%p for n from 4 do
%p if not issqr(n) and isA001597(n) then
%p printf("%d,\n",n);
%p end if;
%p end do: # _R. J. Mathar_, Jan 13 2021
%t nn = 50653; Select[Union[Flatten[Table[n^i, {i, Prime[Range[2, PrimePi[Log[2, nn]]]]}, {n, 2, nn^(1/i)}]]], ! IntegerQ[Sqrt[#]] &] (* _T. D. Noe_, Apr 19 2011 *)
%o (Haskell)
%o import Data.Map (singleton, findMin, deleteMin, insert)
%o a097054 n = a097054_list !! (n-1)
%o a097054_list = f 9 (3, 2) (singleton 4 (2, 2)) where
%o f zz (bz, be) m
%o | xx < zz && even be =
%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 (PARI) is(n)=ispower(n)%2 \\ _Charles R Greathouse IV_, Aug 28 2016
%o (PARI) list(lim)=my(v=List()); forprime(e=3,logint(lim\=1,2), for(b=2,sqrtnint(lim,e), if(!issquare(b), listput(v,b^e)))); Set(v) \\ _Charles R Greathouse IV_, Jan 09 2023
%o (Python)
%o from sympy import mobius, integer_nthroot
%o def A097054(n):
%o def f(x): return int(n-1+x+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(3,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), A000290 (the squares), A008683, A070265 (odd powers), A097055, A097056, A239870, A239728, A093771.
%K nonn,easy
%O 1,1
%A _Hugo Pfoertner_, Jul 21 2004