login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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