
PROG

(PARI) is_A002113(n)={Vecrev(n=digits(n))==n}; \\ M. F. Hasler in A002113
arepalf(nf, x)={forstep(j=nf, 1, 1, if(is_A002113(x[j, 1]), , return(0))); return(1)};
md=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; \\ Middle digits in odd length palindromes
a=vector(64); a[1]=2; a[2]=4; a[3]=8;
for(d=2, 11, print("Digits: ", d); if(d%2==0, for(k=10^((d2)/2), 10*10^((d2)/2)1, my(dv=digits(k)); P=fromdigits(concat(dv, Vecrev(dv))); x=factor(P); bigom=vecsum(x[, 2]); nf=#x[, 2]; for(j=1, #a, if(a[j], , if(j==bigom, if(arepalf(nf, x), print("a(", j, ")=", a[j]=P)))))), for(k=10^((d3)/2), 10*10^((d3)/2)1, my(dv=digits(k)); for(m=1, 10, P=fromdigits(concat(concat(dv, md[m]), Vecrev(dv))); x=factor(P); bigom=vecsum(x[, 2]); nf=#x[, 2]; for(j=1, #a, if(a[j], , if(j==bigom, if(arepalf(nf, x), print("a(", j, ")=", a[j]=P))))))))); a \\ Hugo Pfoertner, Aug 13 2019
