OFFSET
1,1
COMMENTS
For n > 1, a(n) is position of primes in A026741.
A251561(a(n)) != a(n). - Reinhard Zumkeller, Dec 27 2014
Number of terms <= n is pi(n) + pi(n/2). - Robert G. Wilson v, Aug 04 2017
Number of terms <=10^k: 7, 40, 263, 1898, 14725, 120036, 1013092, 8762589, 77203401, 690006734, 6237709391, 56916048160, 523357198488, 4843865515369, ..., . - Robert G. Wilson v, Aug 04 2017
Complement of A264828. - Chai Wah Wu, Oct 17 2024
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
MATHEMATICA
Select[Range[163], Or[PrimeQ[#], PrimeQ[1/2 #]] &] (* Ant King, Jan 29 2011 *)
upto=200; With[{pr=Prime[Range[PrimePi[upto]]]}, Select[Sort[Join[pr, 2pr]], # <= upto&]] (* Harvey P. Dale, Sep 23 2014 *)
PROG
(Haskell)
a001751 n = a001751_list !! (n-1)
a001751_list = 2 : filter (\n -> (a010051 $ div n $ gcd 2 n) == 1) [1..]
-- Reinhard Zumkeller, Jun 20 2011 (corrected, improved), Dec 17 2010
(PARI) isA001751(n)=isprime(n/gcd(n, 2)) || n==2
(PARI) list(lim)=vecsort(concat(primes(primepi(lim)), 2* primes(primepi(lim\2)))) \\ Charles R Greathouse IV, Oct 31 2012
(Python)
from sympy import primepi
def A001751(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+x-primepi(x)-primepi(x>>1))
return bisection(f, n, n) # Chai Wah Wu, Oct 17 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved