login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A274321 Primes equal to a concatenation of a prime and a nonzero palindromic number. 1

%I #37 Nov 15 2016 12:15:41

%S 13,17,23,29,31,37,43,47,53,59,67,71,73,79,83,97,113,131,137,139,167,

%T 173,179,191,193,197,199,211,223,227,229,233,239,241,271,277,283,293,

%U 311,313,317,331,337,347,353,359,367,373,379,383,389,397,419,431,433,439

%N Primes equal to a concatenation of a prime and a nonzero palindromic number.

%H David A. Corneth, <a href="/A274321/b274321.txt">Table of n, a(n) for n = 1..4366</a>

%o (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])}

%o 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])}

%o conc(a, b) = {a * 10^(#digits(b)) + b} \\ _David A. Corneth_, Jun 18 2016

%o (PARI) ispal(n) = n && (eval(subst(Polrev(digits(n)), x, 10)) == n);

%o 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)););}

%o isok(n) = isprime(n) && isconc(n); \\ _Michel Marcus_, Jun 20 2016

%Y Cf. A000040, A002113.

%K nonn,easy,base

%O 1,1

%A _Giovanni Teofilatto_, Jun 18 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 08:33 EDT 2024. Contains 371905 sequences. (Running on oeis4.)