cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A046255 #16 May 09 2021 09:40:06
%S A046255 5,9,9,21,53,67,71,87,87,91,117,161,187,213,363,419,501,537,543,739,
%T A046255 879,1101,1329,1391,1641,1939,2093,2109,2331,2557,2639,2697,2863,3441,
%U A046255 3441,4413,4461,4479,4557,5489,6033,6267,6351,6973,7181,7459,7679,8113,8241
%N 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.
%H A046255 Robert Israel, <a href="/A046255/b046255.txt">Table of n, a(n) for n = 1..300</a>
%p A046255 R:= 5: p:= 5: x:= 5:
%p A046255 for count from 2 to 100 do
%p A046255   for y from x by 2 do
%p A046255     if isprime(10^(1+ilog10(y))*p+y) then
%p A046255       R:= R, y; p:= 10^(1+ilog10(y))*p+y; x:= y;
%p A046255       break
%p A046255     fi
%p A046255 od od:
%p A046255 R; # _Robert Israel_, Nov 22 2020
%t A046255 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 A046255 (Python)
%o A046255 from sympy import isprime
%o A046255 def aupton(terms):
%o A046255   alst, astr = [5], "5"
%o A046255   while len(alst) < terms:
%o A046255     an = alst[-1]
%o A046255     while an%5 ==0 or not isprime(int(astr + str(an))): an += 2
%o A046255     alst, astr = alst + [an], astr + str(an)
%o A046255   return alst
%o A046255 print(aupton(49)) # _Michael S. Branicky_, May 09 2021
%Y A046255 Cf. A069607, A074341, A033680, A033679, A033681, A046254, A046256, A046257, A046258, A046259, A111524.
%K A046255 nonn
%O A046255 1,1
%A A046255 _Patrick De Geest_, May 15 1998