login
a(n) = most common final digit for a prime with n digits, or 0 if there is a tie.
2

%I #28 Jul 11 2014 09:10:11

%S 0,3,7,3,7,3,7,7,3,3,1,7,3,7

%N a(n) = most common final digit for a prime with n digits, or 0 if there is a tie.

%e Primes with two digits are {11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}. The most frequent last digit is a 3. Thus a(2) = 3.

%o (Python)

%o import sympy

%o from sympy import isprime

%o def end(d,n):

%o ..lst = []

%o ..for k in range(10**(d-1),10**d):

%o ....num = ''

%o ....count = 0

%o ....for i in range(10**(n-d-1),10**(n-d)):

%o ......if isprime(int(str(i)+str(k))):

%o ........count += 1

%o ....lst.append(count)

%o ..a = max(lst)

%o ..lst[lst.index(a)] = 0

%o ..b = max(lst)

%o ..if a == b:

%o ....return 0

%o ..else:

%o ....return max(a,b) + 10**(d-1)

%o n = 2

%o while n < 10:

%o ..print(end(1,n),end=', ')

%o ..n += 1

%Y Cf. A244190.

%K nonn,base,hard,more

%O 1,2

%A _Derek Orr_, Jun 22 2014

%E a(9)-a(14) from _Hiroaki Yamanouchi_, Jul 10 2014