OFFSET
1,1
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Perfect Power.
Eric Weisstein's World of Mathematics, Odd Power.
FORMULA
A052409(a(n)) is odd. - Reinhard Zumkeller, Mar 28 2014
Sum_{n>=1} 1/a(n) = 1 - zeta(2) + Sum_{k>=2} mu(k)*(1-zeta(k)) = 0.2295303015... - Amiram Eldar, Dec 21 2020
MAPLE
# uses code of A001597
for n from 4 do
if not issqr(n) and isA001597(n) then
printf("%d, \n", n);
end if;
end do: # R. J. Mathar, Jan 13 2021
MATHEMATICA
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 *)
PROG
(Haskell)
import Data.Map (singleton, findMin, deleteMin, insert)
a097054 n = a097054_list !! (n-1)
a097054_list = f 9 (3, 2) (singleton 4 (2, 2)) where
f zz (bz, be) m
| xx < zz && even be =
f zz (bz, be+1) (insert (bx*xx) (bx, be+1) $ deleteMin m)
| xx < zz = xx :
f zz (bz, be+1) (insert (bx*xx) (bx, be+1) $ deleteMin m)
| xx > zz = f (zz+2*bz+1) (bz+1, 2) (insert (bz*zz) (bz, 3) m)
| otherwise = f (zz + 2 * bz + 1) (bz + 1, 2) m
where (xx, (bx, be)) = findMin m
-- Reinhard Zumkeller, Mar 28 2014
(PARI) is(n)=ispower(n)%2 \\ Charles R Greathouse IV, Aug 28 2016
(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
(Python)
from sympy import mobius, integer_nthroot
def A097054(n):
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())))
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,easy
AUTHOR
Hugo Pfoertner, Jul 21 2004
STATUS
approved