cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A045709 Primes with first digit 3.

This page as a plain text file.
%I A045709 #31 Dec 08 2024 17:16:41
%S A045709 3,31,37,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,
%T A045709 397,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,
%U A045709 3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229
%N A045709 Primes with first digit 3.
%H A045709 Vincenzo Librandi, <a href="/A045709/b045709.txt">Table of n, a(n) for n = 1..5000</a>
%t A045709 Select[Table[Prime[n], {n, 4000}], First[IntegerDigits[#]]==3 &] (* _Vincenzo Librandi_, Aug 08 2014 *)
%o A045709 (PARI) isok(n) = isprime(n) && (digits(n, 10)[1] == 3) \\ _Michel Marcus_, Jun 08 2013
%o A045709 (Magma) [p: p in PrimesUpTo(3300) | Intseq(p)[#Intseq(p)] eq 3]; // _Vincenzo Librandi_, Aug 08 2014
%o A045709 (Python)
%o A045709 from itertools import chain, count, islice
%o A045709 from sympy import primerange
%o A045709 def A045709_gen(): # generator of terms
%o A045709     return chain.from_iterable(primerange(3*(m:=10**l),m<<2) for l in count(0))
%o A045709 A045709_list = list(islice(A045709_gen(),40)) # _Chai Wah Wu_, Dec 07 2024
%o A045709 (Python)
%o A045709 from sympy import primepi
%o A045709 def A045709(n):
%o A045709     def bisection(f,kmin=0,kmax=1):
%o A045709         while f(kmax) > kmax: kmax <<= 1
%o A045709         while kmax-kmin > 1:
%o A045709             kmid = kmax+kmin>>1
%o A045709             if f(kmid) <= kmid:
%o A045709                 kmax = kmid
%o A045709             else:
%o A045709                 kmin = kmid
%o A045709         return kmax
%o A045709     def f(x): return n+x+primepi(min(3*(m:=10**(l:=len(str(x))-1))-1,x))-primepi(min((m<<2)-1,x))+sum(primepi(3*(m:=10**i)-1)-primepi((m<<2)-1) for i in range(l))
%o A045709     return bisection(f,n,n) # _Chai Wah Wu_, Dec 07 2024
%Y A045709 Cf. A000040.
%Y A045709 For primes with initial digit d (1 <= d <= 9) see A045707, A045708, A045709, A045710, A045711, A045712, A045713, A045714, A045715; A073517, A073516, A073515, A073514, A073513, A073512, A073511, A073510, A073509.
%Y A045709 Column k=3 of A262369.
%K A045709 nonn,base,easy
%O A045709 1,1
%A A045709 _Felice Russo_
%E A045709 More terms from _Erich Friedman_.