login
A103144
Decimal primes whose decimal representation in hex is also prime.
5
2, 3, 5, 7, 11, 13, 17, 29, 43, 47, 53, 59, 61, 67, 71, 83, 89, 97, 101, 107, 137, 139, 151, 167, 191, 199, 223, 233, 239, 241, 251, 257, 269, 277, 281, 283, 293, 313, 337, 347, 359, 373, 397, 409, 419, 443, 449, 463, 503, 509, 557, 577, 593, 599, 607, 617, 641
OFFSET
1,1
EXAMPLE
11 is prime, Hex(11) = 17 is prime, hence 11 is in the sequence.
MATHEMATICA
Select[Prime@ Range@ 120, PrimeQ@ FromDigits[IntegerDigits@ #, 16] &] (* Michael De Vlieger, Nov 05 2018 *)
PROG
(MATLAB) a = primes(300000); j = 0; for i = 1:19000 b = dec2hex(a(i)); c = num2str(b); d = str2num(c); if d < 2^32 if isprime(d) j = j + 1; e(j) = d; end; end; end;
(PARI) isok(p) = isprime(p) && isprime(fromdigits(digits(p), 16)); \\ Michel Marcus, Nov 05 2018
(Python)
from sympy import isprime
def ok(n): return isprime(n) and isprime(int(str(n), 16))
print([k for k in range(642) if ok(k)]) # Michael S. Branicky, Dec 04 2022
CROSSREFS
Cf. A089971.
Sequence in context: A007693 A174048 A249644 * A105909 A197187 A086498
KEYWORD
easy,nonn,base
AUTHOR
Lei Zhou, Jan 26 2005
STATUS
approved