A045708 Primes with first digit 2.
2, 23, 29, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Haskell
a045708 n = a045708_list !! (n-1) a045708_list = filter ((== 2) . a000030) a000040_list -- Reinhard Zumkeller, Mar 16 2012
-
Magma
[p: p in PrimesUpTo(2300) | Intseq(p)[#Intseq(p)] eq 2]; // Vincenzo Librandi, Aug 08 2014
-
Mathematica
Select[Table[Prime[n], {n, 3000}], First[IntegerDigits[#]]==2 &] (* Vincenzo Librandi, Aug 08 2014 *)
-
Python
from sympy import isprime def agen(limit=float('inf')): yield 2 digits, adder = 1, 20 while True: for i in range(1, 10**digits, 2): test = adder + i if test > limit: return if isprime(test): yield test digits, adder = digits+1, adder*10 agento = lambda lim: agen(limit=lim) print(list(agento(2222))) # Michael S. Branicky, Feb 23 2021
-
Python
from sympy import primepi def A045708(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 n+x+primepi(min(((m:=10**(l:=len(str(x))-1))<<1)-1,x))-primepi(min(3*m-1,x))+sum(primepi(((m:=10**i)<<1)-1)-primepi(3*m-1) for i in range(l)) return bisection(f,n,n) # Chai Wah Wu, Dec 07 2024
Formula
See A045707 for comments on density of these sequences.
Extensions
More terms from Erich Friedman.
Offset fixed by Reinhard Zumkeller, Mar 15 2012