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

%I #36 Mar 04 2019 18:16:15

%S 0,57,0,97,71,93,59,73,47,51,19,27

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

%C 21 and 23 are tied with 4-digit primes so a(4) = 0.

%e Of the primes with 3 digits, the most common 2 digit ending is 57. Thus a(3) = 57.

%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 = 3

%o while n < 10:

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

%o ..n += 1

%Y Cf. A244189.

%K nonn,base,hard,more

%O 2,2

%A _Derek Orr_, Jun 22 2014

%E a(9) from _Tom Edgar_, Jun 24 2014

%E a(10)-a(12) from _Hiroaki Yamanouchi_, Jul 11 2014

%E a(13) from _Marek Hubal_, Mar 04 2019