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.

A082623 a(1) = 5, a(n) = smallest palindromic prime obtained by inserting two digits anywhere in a(n-1).

This page as a plain text file.
%I A082623 #25 Sep 20 2019 11:12:29
%S A082623 5,151,10501,1035301,103515301,10325152301,1013251523101,
%T A082623 101325181523101,10132512821523101,1013251428241523101,
%U A082623 101322514282415223101,10132245142824154223101,1013224514281824154223101,101322451402818204154223101,10132245014028182041054223101
%N A082623 a(1) = 5, a(n) = smallest palindromic prime obtained by inserting two digits anywhere in a(n-1).
%C A082623 a(78) is the last term, as none of the candidates for a(79) is prime. - _Giovanni Resta_, Sep 20 2019
%H A082623 Giovanni Resta, <a href="/A082623/b082623.txt">Table of n, a(n) for n = 1..78</a>
%p A082623 cp:= proc(x,y) if x[1] < y[1] then true
%p A082623            elif x[1] > y[1] then false
%p A082623            elif nops(x)=1 then true
%p A082623            else procname(x[2..-1],y[2..-1])
%p A082623            fi
%p A082623 end proc: A[1]:= 5: L:= [5]:
%p A082623 for n from 2 to 15 do
%p A082623   nL:= nops(L);
%p A082623   Lp:= sort([seq(seq([op(L[1..i]), x, op(L[i+1..-1])], x=`if`(i=0, 1..9, 0..9)), i=0..nL)], cp);
%p A082623   cands:= map(t -> add(t[i]*(10^(i-1)+10^(2*nL+1-i)), i=1..nL)+t[nL+1]*10^(nL), Lp);
%p A082623   found:= false;
%p A082623   for i from 1 to nops(cands) do
%p A082623     if isprime(cands[i]) then
%p A082623       A[n]:= cands[i];
%p A082623       L:= Lp[i];
%p A082623       found:= true;
%p A082623       break
%p A082623     fi
%p A082623   od;
%p A082623   if not found then break fi
%p A082623 od:
%p A082623 seq(A[i],i=1..15); # _Robert Israel_, Jan 03 2017, corrected Sep 20 2019
%Y A082623 Cf. A002385, A082620, A082621, A082622, A082624.
%K A082623 base,fini,full,nonn
%O A082623 1,1
%A A082623 _Amarnath Murthy_ and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Apr 29 2003
%E A082623 Terms after a(4) corrected by _Giovanni Resta_, Sep 20 2019