OFFSET
1,1
COMMENTS
Also primes with all divisors starting with digit 1. Complement of A206288 (nonprime numbers with all divisors starting with digit 1) with respect to A206287 (numbers with all divisors starting with digit 1). - Jaroslav Krizek, Mar 04 2012
Cohen and Katz show that the set of primes with first digit 1 has no natural density, but has supernatural/Dirichlet density log_{10} (2) ~= 0.3, the primes with first digit 2 have (supernatural) density log_{10} (3/2) ~= 0.176, ... and the primes with first digit 9 have density log_{10} (10/9) ~= 0.046. This would seem to explain the first digit phenomenon. Note that sum_{k = 1}^9 log_{10} (k+1)/k = 1. - Gary McGuire, Dec 22 2004
Lower density is 1/9, upper density is 5/9. The Dirichlet density, if it exists, is always between the lower and upper density (as it does and is in this case). - Charles R Greathouse IV, Sep 26 2022
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.
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 *)
PROG
(Magma) [p: p in PrimesUpTo(10^4) | IsOne(Intseq(p)[#Intseq(p)])]; // Bruno Berselli, Jul 19 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))
(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
CROSSREFS
KEYWORD
nonn,base,easy,changed
AUTHOR
EXTENSIONS
More terms from Erich Friedman.
Cohen-Katz reference from Victor S. Miller, Dec 21 2004
STATUS
approved