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.

A199304 Palindromic primes in the sense of A007500 with digits '0', '1' and '4' only.

This page as a plain text file.
%I A199304 #20 Sep 08 2022 08:46:00
%S A199304 11,101,11411,100411,101141,114001,114041,140411,141101,1004141,
%T A199304 1010411,1040141,1041041,1100441,1114111,1140101,1144441,1401401,
%U A199304 1410401,1411141,1414001,1440011,1444411,1444441,10010411,10011101,10041011,10044011
%N A199304 Palindromic primes in the sense of A007500 with digits '0', '1' and '4' only.
%C A199304 All terms start and end with the digit 1.
%H A199304 Robert Israel, <a href="/A199304/b199304.txt">Table of n, a(n) for n = 1..10000</a>
%p A199304 F:= proc(d) local A0, A4, Res, q, r;
%p A199304    Res:= NULL;
%p A199304    q:= (10^(d+1)-1)/9;
%p A199304    for A0 in combinat:-powerset({$1..d-1}) do
%p A199304      for A4 in combinat:-powerset({$1..d-1} minus A0) do
%p A199304        r:= q - add(10^i,i=A0) + 3*add(10^i,i=A4);
%p A199304        if isprime(r) and isprime(q - add(10^(d-i),i=A0) + 3*add(10^(d-i),i=A4)) then
%p A199304           Res:= Res, r
%p A199304        fi
%p A199304    od od;
%p A199304    Res
%p A199304 end proc:
%p A199304 sort([seq(F(d),d=1..7)]); # _Robert Israel_, May 03 2018
%o A199304 (PARI) allow=Vec("014");forprime(p=1,default(primelimit),setminus( Set( Vec(Str( p ))),allow)&next;isprime(A004086(p))&print1(p",")) /* better use the more efficient code below */
%o A199304 (PARI) a(n=50,list=0,L=[0,1,4],needpal=1)={ for(d=1,1e9, u=vector(d,i,10^(d-i))~; forvec(v=vector(d,i,[1+(i==1&!L[1]),#L]), isprime(t=vector(d,i,L[v[i]])*u) || next; needpal & !isprime(A004086(t)) & next; list & print1(t","); n-- || return(t)))}  \\ _M. F. Hasler_, Nov 06 2011
%o A199304 (Magma) [p: p in PrimesUpTo(10^8) | Set(Intseq(p)) subset [0,1,4] and IsPrime(Seqint(Reverse(Intseq(p))))];  // _Bruno Berselli_, Nov 07 2011
%Y A199304 Cf. A020449 - A020472, A199325 - A199329, A199302 - A199306.
%K A199304 nonn,base
%O A199304 1,1
%A A199304 _M. F. Hasler_, Nov 04 2011