OFFSET
1,3
COMMENTS
Starting at a(1) = 1, this is the lexicographically earliest sequence of distinct numbers whose partial products are all exponentially odd numbers (A268335). - Amiram Eldar, Sep 24 2024
LINKS
Zak Seidov, Table of n, a(n) for n = 1..1000
FORMULA
a(n) ~ n log n. - Charles R Greathouse IV, Oct 14 2016
MATHEMATICA
m=100; Sort[Flatten[{Range[0, m]^2, Prime[Range[PrimePi[m^2]]]}]] (* Zak Seidov, Nov 05 2009 *)
PROG
(Haskell)
a089237 n = a089237_list !! (n-1)
a089237_list = merge a000040_list a000290_list where
merge xs'@(x:xs) ys'@(y:ys) =
if x < y then x : merge xs ys' else y : merge xs' ys
-- Reinhard Zumkeller, Dec 18 2012
(PARI) is(n)=isprime(n) || issquare(n) \\ Charles R Greathouse IV, Oct 14 2016
(PARI) {A89237=List([0..5]); A089237(n)=while(#A89237<n, my(t=A89237[#A89237]); forprime(p=t+1, t=(sqrtint(t)+1)^2, listput(A89237, p)); listput(A89237, t)); A89237[n]} \\ For use in other functions, e.g., A340389. - M. F. Hasler, Jul 24 2021, edited Sep 01 2021
(Python)
from math import isqrt
from sympy import primepi
def A089237(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(n-1+x-primepi(x)-isqrt(x))
return bisection(f, n-1, n-1) # Chai Wah Wu, Oct 12 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Dec 11 2003
STATUS
approved