A046255 a(1) = 5; a(n) is smallest number >= a(n-1) such that the juxtaposition a(1)a(2)...a(n) is a prime.
5, 9, 9, 21, 53, 67, 71, 87, 87, 91, 117, 161, 187, 213, 363, 419, 501, 537, 543, 739, 879, 1101, 1329, 1391, 1641, 1939, 2093, 2109, 2331, 2557, 2639, 2697, 2863, 3441, 3441, 4413, 4461, 4479, 4557, 5489, 6033, 6267, 6351, 6973, 7181, 7459, 7679, 8113, 8241
Offset: 1
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 1..300
Crossrefs
Programs
-
Maple
R:= 5: p:= 5: x:= 5: for count from 2 to 100 do for y from x by 2 do if isprime(10^(1+ilog10(y))*p+y) then R:= R, y; p:= 10^(1+ilog10(y))*p+y; x:= y; break fi od od: R; # Robert Israel, Nov 22 2020
-
Mathematica
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 *)
-
Python
from sympy import isprime def aupton(terms): alst, astr = [5], "5" while len(alst) < terms: an = alst[-1] while an%5 ==0 or not isprime(int(astr + str(an))): an += 2 alst, astr = alst + [an], astr + str(an) return alst print(aupton(49)) # Michael S. Branicky, May 09 2021