login
A001751
Primes together with primes multiplied by 2.
20
2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 17, 19, 22, 23, 26, 29, 31, 34, 37, 38, 41, 43, 46, 47, 53, 58, 59, 61, 62, 67, 71, 73, 74, 79, 82, 83, 86, 89, 94, 97, 101, 103, 106, 107, 109, 113, 118, 122, 127, 131, 134, 137, 139, 142, 146, 149, 151, 157, 158, 163, 166
OFFSET
1,1
COMMENTS
For n > 1, a(n) is position of primes in A026741.
For n > 1, a(n) is the position of the ones in A046079. - Ant King, Jan 29 2011
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
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
Union of A001747 and A000040.
Subsequence of A039698 and of A033948.
Sequence in context: A364869 A245809 A064295 * A191927 A116000 A251595
KEYWORD
nonn,easy
STATUS
approved