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.

A030675 Smallest nontrivial extension of n-th palindrome which is a prime.

This page as a plain text file.
%I A030675 #12 Sep 18 2018 04:50:03
%S A030675 11,23,31,41,53,61,71,83,97,113,223,331,443,557,661,773,881,991,1013,
%T A030675 1117,1213,1319,14107,1511,1613,17107,1811,1913,2027,2129,2221,23201,
%U A030675 2423,2521,2621,2729,28201,2927,3037,3137,32303,3331,3433
%N A030675 Smallest nontrivial extension of n-th palindrome which is a prime.
%H A030675 Robert Israel, <a href="/A030675/b030675.txt">Table of n, a(n) for n = 1..10000</a>
%F A030675 a(n) = A030665(A002113(n+1)). - _Robert Israel_, Sep 18 2018
%p A030675 lpe:= proc(n) local b,d,x;
%p A030675   for d from 1 do
%p A030675     b:= 10^d*n;
%p A030675     for x from b+1 to b+10^d-1 by 2 do
%p A030675       if isprime(x) then return x fi
%p A030675     od
%p A030675   od
%p A030675 end proc:
%p A030675 digrev:= proc(n) local L,i;
%p A030675   L:= convert(n,base,10);
%p A030675   add(L[-i]*10^(i-1),i=1..nops(L))
%p A030675 end proc:
%p A030675 N:= 4: # to use all palindromes of up to N digits
%p A030675 Res:= seq(lpe(n),n=1..9):
%p A030675 for d from 2 to N do
%p A030675   if d::even then
%p A030675     m:= d/2;
%p A030675     Res:= Res, seq(lpe(n*10^m + digrev(n)), n=10^(m-1)..10^m-1);
%p A030675   else
%p A030675     m:= (d-1)/2;
%p A030675     Res:= Res, seq(seq(lpe(n*10^(m+1)+y*10^m+digrev(n)), y=0..9), n=10^(m-1)..10^m-1);
%p A030675   fi
%p A030675 od:
%p A030675 Res; # _Robert Israel_, Sep 18 2018
%t A030675 d[n_]:=IntegerDigits[n]; Table[i=1; While[!PrimeQ[x=FromDigits[Flatten[{d[n],d[i]}]]],i=i+2]; x, {n,Select[Range[350],Reverse[x=d[#]]==x &]}]  (* _Jayanta Basu_, May 24 2013 *)
%Y A030675 Cf. A002113, A030665.
%K A030675 nonn,base,look
%O A030675 1,1
%A A030675 _Patrick De Geest_
%E A030675 Corrected by _Robert Israel_, Sep 18 2018