OFFSET
2,1
COMMENTS
When written in base n, these are the smallest primes that end with the largest base-n metadrome (A023811).
a(386) has 1002 digits. - Michael S. Branicky, Apr 24 2023
LINKS
Michael S. Branicky, Table of n, a(n) for n = 2..385
FORMULA
a(n) = k*(n^n) + (-1 + n - n^2 + n^n)/((-1 + n)^2), where k > 0 is the least integer such that a(n) is prime.
EXAMPLE
a(2) = 5 because 5 = 101_2.
a(3) = 59 because 59 = 2012_3.
a(4) = 283 because 283 = 10123_4.
a(12) = 16*(12^12) + (-1 + 12 - 12^2 + 12^12)/((-1+12)^2) = 142731293952659 is the least prime (at k = 16).
MAPLE
f:= proc(n) local k, s, m;
s:= (-1 + n - n^2 + n^n)/((-1 + n)^2);
m:= n^n;
for k from 1 do if isprime(k*m+s) then return k*m+s fi od
end proc:
map(f, [$2..20]); # Robert Israel, Apr 28 2023
PROG
(Python)
from sympy import isprime
from itertools import count
def a(n):
c, d = n**n, (-1 + n - n**2 + n**n)//((-1 + n)**2)
return next(ak for ak in count(c+d, c) if isprime(ak))
print([a(n) for n in range(2, 23)]) # Michael S. Branicky, Apr 24 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Pedro A. B. A. Vinhas, Apr 24 2023
EXTENSIONS
a(17)-a(19) from Michael S. Branicky, Apr 24 2023
STATUS
approved