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.

A050784 Palindromic primes containing no pair of consecutive equal digits.

This page as a plain text file.
%I A050784 #16 Aug 19 2021 06:41:31
%S A050784 2,3,5,7,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,
%T A050784 10301,10501,10601,12421,12721,12821,13831,13931,14341,14741,15451,
%U A050784 16061,16361,16561,17471,17971,18181,18481,19391,19891,30103,30203
%N A050784 Palindromic primes containing no pair of consecutive equal digits.
%H A050784 Robert Israel, <a href="/A050784/b050784.txt">Table of n, a(n) for n = 1..10000</a>
%p A050784 nextL:= proc(L) local V,j,n,k;
%p A050784   n:= LinearAlgebra:-Dimension(L);
%p A050784   V:= L;
%p A050784   for j from n to 1 by -1 do
%p A050784     V[j]:= V[j]+1;
%p A050784     if j > 1 then if V[j] = V[j-1] then V[j]:= V[j]+1 fi
%p A050784     elif member(V[j],[2,8]) then V[j]:= V[j]+1
%p A050784     elif member(V[j],[4,5,6]) then V[j]:= 7
%p A050784     fi;
%p A050784     if V[j] <= 9 then
%p A050784       for k from j+1 to n do if (k-j)::odd then V[k]:= 0 else V[k]:= 1 fi od;
%p A050784       return V
%p A050784     fi;
%p A050784   od;
%p A050784   Vector(n+1, i -> i mod 2)
%p A050784 end proc:
%p A050784 Pali:= proc(L)
%p A050784   local i,n;
%p A050784   n:= LinearAlgebra:-Dimension(L);
%p A050784   add(L[i]*10^(2*n-i-1),i=1..n)+add(L[i]*10^(i-1),i=1..n-1)
%p A050784 end proc:
%p A050784 V:= <5>: Res:= 2,3,5: count:= 3:
%p A050784 while count < 100 do
%p A050784   V:= nextL(V);
%p A050784   x:= Pali(V);
%p A050784   if isprime(x) then count:= count+1; Res:= Res, x fi;
%p A050784 od:
%p A050784 Res; # _Robert Israel_, Feb 07 2019
%t A050784 Select[Prime[Range[3280]],Reverse[x=IntegerDigits[#]]==x&&FreeQ[Differences[x],0]&] (* _Jayanta Basu_, Jun 01 2013 *)
%Y A050784 Cf. A002385, A050783, A030147, A050757, A046075.
%K A050784 nonn,base
%O A050784 1,1
%A A050784 _Patrick De Geest_, Sep 15 1999