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.

A053582 a(n+1) is the smallest prime ending with a(n), where a(1)=1.

This page as a plain text file.
%I A053582 #29 Dec 30 2023 23:49:05
%S A053582 1,11,211,4211,34211,234211,4234211,154234211,3154234211,93154234211,
%T A053582 2093154234211,42093154234211,342093154234211,11342093154234211,
%U A053582 3111342093154234211,63111342093154234211,2463111342093154234211,232463111342093154234211
%N A053582 a(n+1) is the smallest prime ending with a(n), where a(1)=1.
%H A053582 <a href="/A053582/b053582.txt">Table of n, a(n) for n = 1..501</a>
%e A053582 The least prime ending with seed 1 is 11; the least prime ending with 11 is 211; the least prime ending with 211 is 4211. - _Clark Kimberling_, Sep 17 2015
%p A053582 R:= 1: v:= 1:
%p A053582 for iter from 1 to 30 do
%p A053582 d:= ilog10(v)+1;
%p A053582 for x from v+10^d by 10^d do
%p A053582   if isprime(x) then R:= R, x; v:= x; break fi
%p A053582 od
%p A053582 od:
%p A053582 R; # _Robert Israel_, Sep 24 2020
%t A053582 f[n_] := f[n] = Block[{j = f[n - 1], k = 1, l = Floor[Log[10, f[n - 1]] + 1]},   While[m = k*10^l + j; ! PrimeQ@ m, k++ ]; m]; f[1] = 1; Array[f, 17]
%t A053582 nxt[n_]:=Module[{k=1,p=10^IntegerLength[n]},While[!PrimeQ[k*p+n],k++];k*p+n]; NestList[nxt,1,20] (* _Harvey P. Dale_, Jul 14 2016 *)
%o A053582 (Python)
%o A053582 from sympy import isprime
%o A053582 from itertools import count, islice
%o A053582 def agen(an=1): # generator of terms
%o A053582     while True:
%o A053582         yield an
%o A053582         pow10 = 10**len(str(an))
%o A053582         for t in count(pow10+an, step=pow10):
%o A053582             if isprime(t):
%o A053582                 an = t
%o A053582                 break
%o A053582 print(list(islice(agen(), 18))) # _Michael S. Branicky_, Jun 23 2022
%Y A053582 Cf. A053583, A053584, A069612.
%K A053582 base,nonn
%O A053582 1,2
%A A053582 _G. L. Honaker, Jr._, Jan 18 2000
%E A053582 a(14)-a(17) corrected by _Robert G. Wilson v_, Dec 07 2010