login
Primes whose digit reversal is twice a prime.
1

%I #23 Jun 17 2021 06:04:43

%S 41,43,47,83,229,241,263,283,419,431,433,439,479,491,601,607,641,643,

%T 647,661,683,811,853,857,859,877,2039,2063,2069,2083,2099,2203,2207,

%U 2251,2273,2281,2287,2411,2417,2423,2437,2467,2473,2617,2621,2663,2671,2677,2683,2687,2689,2801,2819,2837

%N Primes whose digit reversal is twice a prime.

%H Karl-Heinz Hofmann, <a href="/A345346/b345346.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 47 is a term because 47 and 74/2 = 37 are primes.

%p revdigs:= proc(n) local L,i;

%p L:= convert(n,base,10);

%p add(L[-i]*10^(i-1),i=1..nops(L))

%p end proc:

%p filter:= proc(n) isprime(n) and numtheory:-bigomega(revdigs(n))=2 end proc:

%p select(filter, [seq(seq(seq(i*10^d+j,j=1..10^d-1,2),i=2..8,2),d=1..4)]);

%o (PARI) isok(p) = if (isprime(p), my(r=fromdigits(Vecrev(digits(p)))); if (!(r%2), isprime(r/2))); \\ _Michel Marcus_, Jun 15 2021

%o (Python) from sympy import isprime, primerange

%o def ok(p): t = int(str(p)[::-1]); return t%2 == 0 and isprime(t//2)

%o print(list(filter(ok, primerange(1, 2838)))) # _Michael S. Branicky_, Jun 16 2021

%Y Intersection of A085778 and A273892.

%K nonn,base

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Jun 14 2021