OFFSET
1,3
COMMENTS
a(n)=1 only for some powers of 2.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
78125=5^7 follows 78121, the difference is 4.
MAPLE
N:= 10^5: # to consider prime powers <= N
P:= select(isprime, [2, seq(i, i=3..floor(sqrt(N)), 2)]):
PP:= sort([seq(seq(p^k, k=2..ilog[p](N)), p=P)]):
map(t -> t - prevprime(t), PP); # Robert Israel, Nov 13 2024
PROG
(Python)
from sympy import primepi, integer_nthroot, prevprime
def A060847(n):
def f(x): return int(n+x-sum(primepi(integer_nthroot(x, k)[0]) for k in range(2, x.bit_length())))
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
return (a:=bisection(f, n, n))-prevprime(a) # Chai Wah Wu, Sep 13 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, May 03 2001
STATUS
approved