A056798 Prime powers with even nonnegative exponents.
1, 4, 9, 16, 25, 49, 64, 81, 121, 169, 256, 289, 361, 529, 625, 729, 841, 961, 1024, 1369, 1681, 1849, 2209, 2401, 2809, 3481, 3721, 4096, 4489, 5041, 5329, 6241, 6561, 6889, 7921, 9409, 10201, 10609, 11449, 11881, 12769, 14641, 15625, 16129, 16384
Offset: 1
Keywords
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Take[Union[Flatten[Table[Prime[n]^k, {n, 31}, {k, 0, 14, 2}]]], 45] (* Alonso del Arte, Jul 05 2011 *)
-
PARI
is(n)=my(e=isprimepower(n)); if(e, e%2==0, n==1) \\ Charles R Greathouse IV, Sep 18 2015
-
Python
from sympy import primepi, integer_nthroot def A056798(n): if n==1: return 1 def f(x): return int(n-2+x-sum(primepi(integer_nthroot(x,k)[0])for k in range(2,x.bit_length(),2))) 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 13 2024
Comments