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.

A045711 Primes with first digit 5.

This page as a plain text file.
%I A045711 #25 Dec 08 2024 17:18:35
%S A045711 5,53,59,503,509,521,523,541,547,557,563,569,571,577,587,593,599,5003,
%T A045711 5009,5011,5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,
%U A045711 5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261
%N A045711 Primes with first digit 5.
%C A045711 Subsequence of A000040.
%H A045711 Vincenzo Librandi, <a href="/A045711/b045711.txt">Table of n, a(n) for n = 1..5000</a>
%t A045711 Select[Table[Prime[n], {n, 5300}], First[IntegerDigits[#]]==5 &] (* _Vincenzo Librandi_, Aug 08 2014 *)
%o A045711 (Magma) [p: p in PrimesUpTo(5300) | Intseq(p)[#Intseq(p)] eq 5]; // _Vincenzo Librandi_, Aug 08 2014
%o A045711 (Python)
%o A045711 from itertools import chain, count, islice
%o A045711 from sympy import primerange
%o A045711 def A045711_gen(): # generator of terms
%o A045711     return chain.from_iterable(primerange(5*(m:=10**l),6*m) for l in count(0))
%o A045711 A045711_list = list(islice(A045711_gen(),40)) # _Chai Wah Wu_, Dec 08 2024
%o A045711 (Python)
%o A045711 from sympy import primepi
%o A045711 def A045711(n):
%o A045711     def bisection(f,kmin=0,kmax=1):
%o A045711         while f(kmax) > kmax: kmax <<= 1
%o A045711         while kmax-kmin > 1:
%o A045711             kmid = kmax+kmin>>1
%o A045711             if f(kmid) <= kmid:
%o A045711                 kmax = kmid
%o A045711             else:
%o A045711                 kmin = kmid
%o A045711         return kmax
%o A045711     def f(x): return n+x+primepi(min(5*(m:=10**(l:=len(str(x))-1))-1,x))-primepi(min(6*m-1,x))+sum(primepi(5*(m:=10**i)-1)-primepi(6*m-1) for i in range(l))
%o A045711     return bisection(f,n,n) # _Chai Wah Wu_, Dec 08 2024
%Y A045711 Column k=5 of A262369.
%Y A045711 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.
%K A045711 nonn,base,easy
%O A045711 1,1
%A A045711 _Felice Russo_
%E A045711 More terms from _Erich Friedman_.
%E A045711 Leading 5 added by _Jaroslav Krizek_, Apr 29 2010