A045707 Primes with first digit 1.
11, 13, 17, 19, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151
Offset: 1
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..5000
- Daniel I. A. Cohen and Talbot M. Katz, Prime numbers and the first digit phenomenon, J. Number Theory 18 (1984), 261-268.
Crossrefs
Programs
-
Magma
[p: p in PrimesUpTo(10^4) | IsOne(Intseq(p)[#Intseq(p)])]; // Bruno Berselli, Jul 19 2014
-
Mathematica
Select[Table[Prime[n], {n, 500}], First[IntegerDigits[#]] == 1 &] Flatten[Table[Prime[Range[PrimePi[10^n] + 1, PrimePi[2 * 10^n]]], {n, 3}]] (* Alonso del Arte, Jul 18 2014 *)
-
PARI
list(lim)=my(v=[]); for(d=1,#digits(lim\=1)-1, v=concat(v,primes([10^d,min(lim,2*10^d-1)]))); v \\ Charles R Greathouse IV, Sep 26 2022
-
Python
from itertools import chain, count, islice from sympy import primerange def A045707_gen(): # generator of terms return chain.from_iterable(primerange(m:=10**l,(m<<1)) for l in count(0)) A045707_list = list(islice(A045707_gen(),40)) # Chai Wah Wu, Dec 07 2024
-
Python
from sympy import primepi def A045707(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((m:=10**(l:=len(str(x))-1))-1)-primepi(min((m<<1)-1,x))+sum(primepi((m:=10**i)-1)-primepi((m<<1)-1) for i in range(l)) return bisection(f,n,n) # Chai Wah Wu, Dec 07 2024
Extensions
More terms from Erich Friedman.
Cohen-Katz reference from Victor S. Miller, Dec 21 2004
Comments