A065683 Number of primes <= prime(n) which begin with a 4.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 20, 20
Offset: 1
Examples
41 = A000040(13) is the first prime beginning with 4, so a(13) = 1. a(664579) = 74114 (A000040(664579) = 9999991 is the largest prime < 10^7).
Links
- Harry J. Smith, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Table[Count[Take[Prime[Range[100]],n],?(First[IntegerDigits[#]] == 4&)],{n,100}] (* _Harvey P. Dale, Apr 18 2011 *)
-
PARI
lista(n) = { my(a=[p\10^logint(p,10)==4 | p<-primes(n)]); for(i=2, #a, a[i]+=a[i-1]); a} \\ Harry J. Smith, Oct 26 2009