[go: up one dir, main page]

login
A244191
a(n) = most common final digit for a prime < 10^n, or 0 if there is a tie.
2
0, 3, 7, 3, 7, 3, 3, 7, 3, 3, 7, 7, 3, 3
OFFSET
1,2
EXAMPLE
For all 25 primes < 100 (10^2), we see that the last digit that appears the most is 3. Thus a(2) = 3.
PROG
(Python)
import sympy
from sympy import isprime
def prend(d, n):
..lst = []
..for k in range(10**n):
....if isprime(k):
......lst.append((k%10**d))
..new = 0
..newlst = []
..for i in range(10**(d-1), 10**d):
....new = lst.count(i)
....newlst.append(new)
..newlst1 = newlst.copy()
..a = max(newlst1)
..newlst1[newlst1.index(a)] = 0
..b = max(newlst1)
..if a == b:
....return 0
..else:
....return newlst.index(max(a, b)) + 10**(d-1)
n = 2
while n < 10:
..print(prend(1, n), end=', ')
..n += 1
CROSSREFS
KEYWORD
nonn,base,hard,more
AUTHOR
Derek Orr, Jun 22 2014
EXTENSIONS
a(9)-a(14) from Hiroaki Yamanouchi, Sep 27 2014
STATUS
approved