Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #7 Oct 01 2013 17:58:20
%S 11,13,17,31,37,71,73,79,97,101,103,107,109,113,127,131,137,139,149,
%T 151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,
%U 241,251,257,263,269,271,277,281,283,293,307,311,313,317,331
%N Primes with at least two digits such that swapping the second and the penultimate digit yields a prime.
%C Is this sequence infinite?
%H T. D. Noe, <a href="/A111337/b111337.txt">Table of n, a(n) for n=1..10000</a>
%e The prime 612041 is in the sequence because swapping the second and the penultimate digit yields 642011, which is prime.
%t a = {}; For[n = 5, n < 100, n++, b = IntegerDigits[Prime[n]]; {b[[2]], b[[ -2]]} = {b[[ -2]], b[[2]]}; If[PrimeQ[FromDigits[b]], AppendTo[a, Prime[n]]]]; a
%o (PARI) swap(n,d) = \ d is the digit position to swap { local(j,ln,x,s,y,y2,tmp); forprime(x=10^(d-1),10^(d-1)+n, s = Str(x); ln = length(s); y = eval(Vec(s)); tmp=y[d]; y[d]=y[ln-d+1]; y[ln-d+1]=tmp; y2=0; for(j=1,ln, y2+=y[j]*10^(ln-j); ); if(isprime(y2),print1(x",")) ) }
%K base,easy,nonn
%O 1,1
%A _Cino Hilliard_, Nov 05 2005
%E Edited by _Stefan Steinerberger_, Aug 01 2007