OFFSET
1,1
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10001
FORMULA
EXAMPLE
a(1) = 2 because there are 2 primes between 1^2 and 2^2, viz., 2 and 3.
a(2) = 2 because there are 2 primes between 2^2 and 2^3, viz., 5 and 7.
a(3) = 0 because there are no primes between 2^3 and 3^2.
MATHEMATICA
Count[#, _?PrimeQ] & /@ Range @@@ # &@ Partition[#, 2, 1] &@ Select[Range@ 5000, # == 1 || GCD @@ FactorInteger[#][[All, 2]] > 1 &] (* Michael De Vlieger, Jun 30 2016, after Ant King at A001597 *)
PROG
(Python)
from sympy import mobius, integer_nthroot, primepi
def A080769(n):
def f(x): return int(n-1+x+sum(mobius(k)*(integer_nthroot(x, k)[0]-1) 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 int(-primepi(a:=bisection(f, n, n))+primepi(bisection(lambda x:f(x)+1, a, a))) # Chai Wah Wu, Sep 09 2024
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Walter Nissen, Mar 10 2003
EXTENSIONS
Offset corrected by Jianing Song, Nov 19 2019
STATUS
approved