login
A362535
Smallest prime ending with all base-n digits in consecutive order.
1
5, 59, 283, 3319, 95177, 6611219, 17119607, 1168314911, 100123456789, 3426593164037, 142731293952659, 304978405943587, 333425956286418337, 9635899740880849409, 535037563666793483759, 42192484763476168476011, 39482554816041508293677, 39574499346711396207137369
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
Cf. A023811.
Sequence in context: A179029 A049079 A024378 * A112461 A222585 A260630
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
a(17)-a(19) from Michael S. Branicky, Apr 24 2023
STATUS
approved