A065687 Number of primes <= prime(n) which begin with an 8.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1
Examples
83 = A000040(23) is the first prime beginning with an 8, so a(23) = 1 and a(i) = 0 for i < 23. a(664579) = 71038 (A000040(664579) = 9999991 is the largest prime < 10,000,000).
Links
- Harry J. Smith, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Accumulate[If[First[IntegerDigits[#]] == 8, 1, 0]&/@Prime[Range[100]]] (* Vincenzo Librandi, Nov 28 2016 *)
-
PARI
lista(n) = { my(a=[p\10^logint(p,10)==8 | p<-primes(n)]); for(i=2, #a, a[i]+=a[i-1]); a} \\ Harry J. Smith, Oct 26 2009