login
Lesser of consecutive primes whose average is a palindromic number.
2

%I #21 Apr 05 2019 11:58:42

%S 3,5,7,97,109,281,359,389,409,509,631,653,691,743,827,857,907,937,967,

%T 1549,2111,2767,4219,4441,7001,9007,9337,9661,10099,11503,12919,13421,

%U 16759,17569,21011,21611,23831,26261,26861,28181,29287,29483,30497,31307,32213,33029,33629

%N Lesser of consecutive primes whose average is a palindromic number.

%H Harvey P. Dale, <a href="/A242387/b242387.txt">Table of n, a(n) for n = 1..1000</a>

%e 389 is in the sequence because 389 is prime, nextprime(389)=397, and (389+397)/2=393, a palindromic number.

%t Select[Partition[Prime[Range[4000]],2,1],PalindromeQ[Mean[#]]&][[All,1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Apr 05 2019 *)

%o (PARI)

%o palind(n)=Str(n)==concat(Vecrev(Str(n)))

%o {p=2;while(p<10^5,q=nextprime(p+1);if(palind((p+q)/2),print1(p,", "));p=q)}

%Y Cf. A242386.

%K nonn,base,less

%O 1,1

%A _Antonio Roldán_, May 12 2014