login
a(1) = 5; a(n) is smallest number >= a(n-1) such that the juxtaposition a(1)a(2)...a(n) is a prime.
11

%I #16 May 09 2021 09:40:06

%S 5,9,9,21,53,67,71,87,87,91,117,161,187,213,363,419,501,537,543,739,

%T 879,1101,1329,1391,1641,1939,2093,2109,2331,2557,2639,2697,2863,3441,

%U 3441,4413,4461,4479,4557,5489,6033,6267,6351,6973,7181,7459,7679,8113,8241

%N a(1) = 5; a(n) is smallest number >= a(n-1) such that the juxtaposition a(1)a(2)...a(n) is a prime.

%H Robert Israel, <a href="/A046255/b046255.txt">Table of n, a(n) for n = 1..300</a>

%p R:= 5: p:= 5: x:= 5:

%p for count from 2 to 100 do

%p for y from x by 2 do

%p if isprime(10^(1+ilog10(y))*p+y) then

%p R:= R, y; p:= 10^(1+ilog10(y))*p+y; x:= y;

%p break

%p fi

%p od od:

%p R; # _Robert Israel_, Nov 22 2020

%t a[1] = 5; a[n_] := a[n] = Block[{k = a[n - 1], c = IntegerDigits @ Table[ a[i], {i, n - 1}]}, While[ !PrimeQ[ FromDigits @ Flatten @ Append[c, IntegerDigits[k]]], k += 2]; k]; Table[ a[n], {n, 49}] (* _Robert G. Wilson v_, Aug 05 2005 *)

%o (Python)

%o from sympy import isprime

%o def aupton(terms):

%o alst, astr = [5], "5"

%o while len(alst) < terms:

%o an = alst[-1]

%o while an%5 ==0 or not isprime(int(astr + str(an))): an += 2

%o alst, astr = alst + [an], astr + str(an)

%o return alst

%o print(aupton(49)) # _Michael S. Branicky_, May 09 2021

%Y Cf. A069607, A074341, A033680, A033679, A033681, A046254, A046256, A046257, A046258, A046259, A111524.

%K nonn

%O 1,1

%A _Patrick De Geest_, May 15 1998