login
Palindromic primes in base 16 (or hexadecimal), but written here in base 10.
7

%I #17 Aug 11 2024 14:41:30

%S 2,3,5,7,11,13,17,257,337,353,401,433,449,787,883,947,1301,1381,1429,

%T 1493,1831,1847,1879,2039,2377,2393,2441,2473,2521,2843,2939,2971,

%U 3019,3067,3373,3389,3469,3517,3533,3581,3919,3967,4079,65537

%N Palindromic primes in base 16 (or hexadecimal), but written here in base 10.

%H Attila Olah, <a href="/A029732/b029732.txt">Table of n, a(n) for n=1..10000</a>

%H P. De Geest, <a href="https://www.worldofnumbers.com/nobase10.htm">Palindromic numbers beyond base 10</a>

%H Attila Olah, <a href="/A029732/a029732.txt">Table of n, a(n) for n=1..10000</a> (written in hexadecimal)

%t lst={};Do[p=Prime[n];If[IntegerDigits[p,16]==Reverse[IntegerDigits[p,16]],AppendTo[lst,p]],{n,7!}];lst (* _Vladimir Joseph Stephan Orlovsky_, Jul 31 2009 *)

%o (Python)

%o from itertools import chain

%o from sympy import isprime

%o from gmpy2 import digits

%o A029732 = sorted((n for n in chain((int(digits(x,16)+digits(x,16)[::-1],16) for x in range(1,16**5)),(int(digits(x,16)+digits(x,16)[-2::-1],16) for x in range(1,16**5))) if isprime(n)))

%o # _Chai Wah Wu_, Aug 16 2014

%o (PARI) forprime(p=2,10^4, my(d=digits(p,16)); if(d==Vecrev(d),print1(p,", "))); \\ _Joerg Arndt_, Aug 17 2014

%K nonn,base

%O 1,1

%A _Patrick De Geest_