login
A087633
Number of n-digit primes ending in 9 in base 10.
4
0, 5, 33, 265, 2087, 17203, 146439, 1274154, 11271147, 101049993, 915748570, 8372464236, 77114396969
OFFSET
1,2
FORMULA
From Iain Fox, Aug 07 2018: (Start)
a(n) ~ (1/4) * Integral_{x=10^(n-1)..10^n} (dx/log(x)).
a(n) = A006879(n) - A087630(n) - A087631(n) - A087632(n), for n > 1.
(End)
EXAMPLE
a(2) = 5 as there exist 5 two-digit prime numbers (19, 29, 59, 79, and 89) with units place 9.
a(3) = 33, since there are 33 three-digit numbers with units place digit as 9.
MATHEMATICA
Table[Length[Select[Range[10^n + 9, 10^(n + 1) - 1, 10], PrimeQ]], {n, 5}] (* Alonso del Arte, Apr 27 2014 *)
PROG
(Java) /** The terms of the sequences are generated by changing the range for j for the various numbers of digits. E.g., it ranges from 100 to 999 for three-digit numbers. */
float r, x;
int c = 0, count = 0; for (float j = 100f; j < 1000f; j++) { for (float i = 2f; i < j; i++) { r = j % i; if (r == 0) c = 1; } if (c == 0) { x = j % 10; if (x == 9) count = count + 1; } c = 0; } System.out.println("count = " + count);
(PARI) a(n) = my(c=0); forprime(p=10^(n-1), 10^n, if(p%10==9, c++)); c \\ Iain Fox, Aug 07 2018
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Meenakshi Srikanth (menakan_s(AT)yahoo.com) and Amarnath Murthy, Sep 15 2003
EXTENSIONS
Corrected and extended by Ray Chandler, Oct 04 2003
Offset corrected by Iain Fox, Aug 07 2018
a(11) from Iain Fox, Aug 07 2018
a(12)-a(13) from Giovanni Resta, Aug 07 2018
STATUS
approved