A377468 Least perfect-power >= n.
1, 4, 4, 4, 8, 8, 8, 8, 9, 16, 16, 16, 16, 16, 16, 16, 25, 25, 25, 25, 25, 25, 25, 25, 25, 27, 27, 32, 32, 32, 32, 32, 36, 36, 36, 36, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 81, 81, 81
Offset: 1
Keywords
Crossrefs
The version for prime-powers is A000015.
Positions of last appearances are also A001597.
The version for squarefree numbers is A067535.
Run-lengths are A076412.
The opposite version (greatest perfect-power <= n) is A081676.
A069623 counts perfect-powers <= n.
A076411 counts perfect-powers < n.
A131605 lists perfect-powers that are not prime-powers.
Programs
-
Mathematica
perpowQ[n_]:=n==1||GCD@@FactorInteger[n][[All,2]]>1; Table[NestWhile[#+1&,n,#>1&&!perpowQ[#]&],{n,100}]
-
Python
from sympy import mobius, integer_nthroot def A377468(n): if n == 1: return 1 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 = n-f(n-1) return bisection(lambda x:f(x)+m,n-1,n) # Chai Wah Wu, Nov 05 2024
Comments