# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a342681 Showing 1-1 of 1 %I A342681 #20 Sep 08 2022 08:46:26 %S A342681 241,443,613,641,811,20011,20047,20051,20101,20161,20201,20347,20441, %T A342681 20477,21001,21157,21211,21377,21467,22027,22031,22147,22171,22247, %U A342681 22367,23017,23021,23131,23357,23417,23447,24007,24121,24151,24407,25031,25111,25117,25121,26021,26107,26111,26417,27011,27407,28001 %N A342681 Primes which, when added to their reversals, produce palindromic primes. %C A342681 It appears that all terms have an odd number of digits. - _Robert Israel_, Mar 24 2021 %H A342681 Robert Israel, Table of n, a(n) for n = 1..10000 %e A342681 241 is a prime number. The sum with its reverse is 383 = 241+142, which is a palindromic prime. Thus, 241 is in this sequence. %p A342681 revdigs:= proc(n) local i,L; %p A342681 L:= convert(n,base,10); %p A342681 add(L[-i]*10^(i-1),i=1..nops(L)) %p A342681 end proc: %p A342681 ispali:= proc(n) local L; %p A342681 L:= convert(n,base,10); %p A342681 andmap(t -> L[t]=L[-t], [$1..nops(L)/2]) %p A342681 end proc: %p A342681 filter:= proc(t) local r; r:= t + revdigs(t); %p A342681 ispali(r) and isprime(r); %p A342681 end proc: %p A342681 select(filter, [seq(ithprime(i),i=1..10000)]); # _Robert Israel_, Mar 24 2021 %t A342681 Select[Range[30000], PrimeQ[#] && PrimeQ[# + IntegerReverse[#]] && PalindromeQ[# + IntegerReverse[#]] &] %o A342681 (PARI) isok(p) = my(q); isprime(p) && isprime(q=p+fromdigits(Vecrev(digits(p)))) && (q==fromdigits(Vecrev(digits(q)))); \\ _Michel Marcus_, Mar 18 2021 %o A342681 (Python) %o A342681 from sympy import isprime, primerange %o A342681 def ok(p): %o A342681 t = p + int(str(p)[::-1]); strt = str(t) %o A342681 return strt == strt[::-1] and isprime(t) %o A342681 print([p for p in primerange(1, 28002) if ok(p)]) # _Michael S. Branicky_, Mar 18 2021 %o A342681 (Magma) [p: p in PrimesUpTo(10^6) | IsPrime(t) and Intseq(t) eq Reverse(Intseq(t)) where t is p+Seqint(Reverse(Intseq(p)))]; // _Bruno Berselli_, Mar 23 2021 %Y A342681 Cf. A002385. Subsequence of A061783 (Luhn primes: primes p such that p + (p reversed) is also a prime). %K A342681 nonn,base %O A342681 1,1 %A A342681 _Tanya Khovanova_, Mar 18 2021 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE