%I #15 Oct 29 2012 12:20:11
%S 6,0,858,2112,89898,276672,8916198,89522598,898373898,8998558998,
%T 89984248998,899931139998,8999867689998,89999400499998,
%U 899998808899998,8999950220599998,89999961316999998,899999985589999998,8999999741479999998,89999993611639999998
%N a(n) is the largest n-digit palindromic integer surrounded by twin primes, if one exists, or 0 otherwise.
%H The prime puzzles, <a href="http://www.primepuzzles.net/puzzles/puzz_659.htm">Puzzle 659</a>
%o (PARI) a(n)=my(p,t,v,k,j,d,N=n-1);if(n==1,6,if(n==2,0,t=9*10^(N\2);d=6*11^(N%2);forstep(k=t,0,-1,v=digits(k);v=concat(v,vecextract(Vecrev(v),concat(Str((N+1)%2+1),"..")));p=subst(Pol(v),x,10);if(p%d==0&&ispseudoprime(p+1)&&ispseudoprime(p-1),return(p)))))
%K nonn,base
%O 1,1
%A _Igor Schein_, Oct 26 2012