%I #23 May 28 2023 15:40:32
%S 5,59,283,3319,95177,6611219,17119607,1168314911,100123456789,
%T 3426593164037,142731293952659,304978405943587,333425956286418337,
%U 9635899740880849409,535037563666793483759,42192484763476168476011,39482554816041508293677,39574499346711396207137369
%N Smallest prime ending with all base-n digits in consecutive order.
%C When written in base n, these are the smallest primes that end with the largest base-n metadrome (A023811).
%C a(386) has 1002 digits. - _Michael S. Branicky_, Apr 24 2023
%H Michael S. Branicky, <a href="/A362535/b362535.txt">Table of n, a(n) for n = 2..385</a>
%F 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.
%e a(2) = 5 because 5 = 101_2.
%e a(3) = 59 because 59 = 2012_3.
%e a(4) = 283 because 283 = 10123_4.
%e a(12) = 16*(12^12) + (-1 + 12 - 12^2 + 12^12)/((-1+12)^2) = 142731293952659 is the least prime (at k = 16).
%p f:= proc(n) local k,s,m;
%p s:= (-1 + n - n^2 + n^n)/((-1 + n)^2);
%p m:= n^n;
%p for k from 1 do if isprime(k*m+s) then return k*m+s fi od
%p end proc:
%p map(f, [$2..20]); # _Robert Israel_, Apr 28 2023
%o (Python)
%o from sympy import isprime
%o from itertools import count
%o def a(n):
%o c, d = n**n, (-1 + n - n**2 + n**n)//((-1 + n)**2)
%o return next(ak for ak in count(c+d, c) if isprime(ak))
%o print([a(n) for n in range(2, 23)]) # _Michael S. Branicky_, Apr 24 2023
%Y Cf. A023811.
%K nonn,base
%O 2,1
%A _Pedro A. B. A. Vinhas_, Apr 24 2023
%E a(17)-a(19) from _Michael S. Branicky_, Apr 24 2023