login
A218343
a(n) is the largest n-digit palindromic integer surrounded by twin primes, if one exists, or 0 otherwise.
0
6, 0, 858, 2112, 89898, 276672, 8916198, 89522598, 898373898, 8998558998, 89984248998, 899931139998, 8999867689998, 89999400499998, 899998808899998, 8999950220599998, 89999961316999998, 899999985589999998, 8999999741479999998, 89999993611639999998
OFFSET
1,1
LINKS
PROG
(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)))))
CROSSREFS
Sequence in context: A179936 A219952 A156444 * A122192 A357801 A249698
KEYWORD
nonn,base
AUTHOR
Igor Schein, Oct 26 2012
STATUS
approved