A378035 Greatest perfect power < prime(n).
1, 1, 4, 4, 9, 9, 16, 16, 16, 27, 27, 36, 36, 36, 36, 49, 49, 49, 64, 64, 64, 64, 81, 81, 81, 100, 100, 100, 100, 100, 125, 128, 128, 128, 144, 144, 144, 144, 144, 169, 169, 169, 169, 169, 196, 196, 196, 216, 225, 225, 225, 225, 225, 243, 256, 256, 256, 256
Offset: 1
Keywords
Examples
The first number line below shows the perfect powers. The second shows each positive integer k at position prime(k). -1-----4-------8-9------------16----------------25--27--------32------36---- ===1=2===3===4=======5===6=======7===8=======9==========10==11==========12==
Crossrefs
Restriction of A081676 to the primes.
Positions of last appearances are also A377283.
A version for squarefree numbers is A378032.
The union is A378253.
Terms appearing exactly once are A378355.
A069623 counts perfect powers <= n.
A076411 counts perfect powers < n.
A131605 lists perfect powers that are not prime powers.
Programs
-
Mathematica
radQ[n_]:=n>1&&GCD@@Last/@FactorInteger[n]==1; Table[NestWhile[#-1&,Prime[n],radQ[#]&],{n,100}]
-
PARI
a(n) = my(k=prime(n)-1); while (!(ispower(k) || (k==1)), k--); k; \\ Michel Marcus, Nov 25 2024
-
Python
from sympy import mobius, integer_nthroot, prime def A378035(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return int(x-1+sum(mobius(k)*(integer_nthroot(x,k)[0]-1) for k in range(2,x.bit_length()))) m = (p:=prime(n)-1)-f(p) return bisection(lambda x:f(x)+m,m,m) # Chai Wah Wu, Nov 25 2024
Comments