login
Number of n-digit primes ending in 1 in base 10.
5

%I #32 Aug 07 2018 11:13:54

%S 0,5,35,266,2081,17230,146487,1274194,11271088,101050133,915755611,

%T 8372443850,77114409020

%N Number of n-digit primes ending in 1 in base 10.

%F From _Iain Fox_, Aug 07 2018: (Start)

%F a(n) ~ (1/4) * Integral_{x=10^(n-1)..10^n} (dx/log(x)).

%F a(n) = A006879(n) - A087631(n) - A087632(n) - A087633(n), for n > 1.

%F (End)

%e a(2) = 5 as there exist 5 two-digit prime numbers (11, 31, 41, 61, and 71) with units place 1.

%e a(3) = 35, since there are 35 three-digit numbers with units place digit as 1.

%t Table[Length[Select[Range[10^n + 1, 10^(n + 1) - 9, 10], PrimeQ[#] &]], {n, 5}] (* _Alonso del Arte_, Apr 27 2014 *)

%o (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. */

%o float r, x;

%o int c = 0, count = 0;

%o 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 == 1) count = count + 1; } c = 0; } System.out.println("count = " + count);

%o (PARI) a(n) = my(c=0); forprime(p=10^(n-1), 10^n, if(p%10==1, c++)); c \\ _Iain Fox_, Aug 07 2018

%Y Cf. A006879, A073505, A087631, A087632, A087633.

%K nonn,base,hard,more

%O 1,2

%A Meenakshi Srikanth (menakan_s(AT)yahoo.com) and _Amarnath Murthy_, Sep 15 2003

%E More terms from _Ray Chandler_, Oct 04 2003

%E Offset corrected by _Iain Fox_, Aug 07 2018

%E a(11) from _Iain Fox_, Aug 07 2018

%E a(12)-a(13) from _Giovanni Resta_, Aug 07 2018