A087631 Number of n-digit primes ending in 3 in base 10.
1, 6, 35, 268, 2092, 17263, 146565, 1274244, 11272025, 101053126, 915743823, 8372470456, 77114448042
Offset: 1
Examples
a(2) = 6, as there exist 6 two-digit prime numbers (13, 23, 43, 53, 73, and 83) with units place 3. a(3) = 35, since there are 35 three-digit numbers with units place digit as 3.
Programs
-
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 == 3) count = count + 1; } c = 0; } System.out.println("count = " + count);
-
Mathematica
Table[Length[Select[Range[10^n + 3, 10^(n + 1) - 7, 10], PrimeQ[#] &]], {n, 5}] (* Alonso del Arte, Apr 27 2014 *)
-
PARI
a(n) = my(c=0); forprime(p=10^(n-1), 10^n, if(p%10==3, c++)); c \\ Iain Fox, Aug 07 2018
Formula
Extensions
More terms from 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