A065684 Number of primes <= prime(n) which begin with a 5.
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11
Offset: 1
Examples
a(i) = 1 for 2 < i < 16 and a(16) = 2 as 53 = A000040(16) is the second prime beginning with 5. a(664579) = 72951 (A000040(664579) = 9999991 is the largest prime < 10^7).
Links
- Harry J. Smith, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Accumulate@ Array[Boole[First@ IntegerDigits@ Prime@ # == 5] &, 103] (* Michael De Vlieger, Jun 14 2018 *)
-
PARI
lista(n) = { my(a=[p\10^logint(p,10)==5 | p<-primes(n)]); for(i=2, #a, a[i]+=a[i-1]); a} \\ Harry J. Smith, Oct 26 2009