login
A274321
Primes equal to a concatenation of a prime and a nonzero palindromic number.
1
13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 113, 131, 137, 139, 167, 173, 179, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 271, 277, 283, 293, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 389, 397, 419, 431, 433, 439
OFFSET
1,1
LINKS
PROG
(PARI) lista() = {my(l = List(), pal = vector(199, i, a2113(i)), pri = vector(primepi(10000)), t=0); forprime(i=2, 10000, t++; pri[t]=i); for(i = 2, #pal, for(j=1, #pri, p = conc(pal[i], pri[j]); if(#digits(p) < 6, if(isprime(p), listput(l, p))); p = conc(pri[j], pal[i]); if(#digits(p) < 6, if(isprime(p), listput(l, p))))); listsort(l, 1); l}a2113(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])}
a2113(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])}
conc(a, b) = {a * 10^(#digits(b)) + b} \\ David A. Corneth, Jun 18 2016
(PARI) ispal(n) = n && (eval(subst(Polrev(digits(n)), x, 10)) == n);
isconc(n) = {d = digits(n); for (k=1, #d, na = n\10^k; nb = n % 10^k; if ((n == eval(concat(Str(na), Str(nb)))) && ((isprime(na) && ispal(nb)) || (isprime(nb) && ispal(na))), return(1)); ); }
isok(n) = isprime(n) && isconc(n); \\ Michel Marcus, Jun 20 2016
CROSSREFS
Sequence in context: A060343 A080603 A179924 * A316603 A235914 A050716
KEYWORD
nonn,easy,base
AUTHOR
Giovanni Teofilatto, Jun 18 2016
STATUS
approved