%I #11 Jul 21 2021 09:33:00
%S 3,5,7,17,47,71,107,223,401,823,827,857,883,2087,2089,2539,3253,4007,
%T 5051,5059,5503,5507,7541,8447,10247,12401,18041,25303,33529,33589,
%U 35533,40427,44171,45557,53503,53653,53899,54401,55001,55009,55333,55817,57077,71147,81017,82003,93553
%N Primes that yield a prime when any single digit is replaced by its 10's complement.
%C Digital complement of a digit d is 10-d if d > 0, 0 otherwise.
%C Primes in A345343.
%e 71147 is a term since 31147, 79147, 71947, 71167 and 71143 are all primes.
%t q[n_] := PrimeQ[n] && Module[{d = IntegerDigits[n]}, And @@ PrimeQ[Table[ FromDigits[ReplacePart[d, i -> If[d[[i]] == 0, d[[i]], 10 - d[[i]]]]], {i, 1, Length[d]}]]]; Select[Range[10^5], q] (* _Amiram Eldar_, Jul 06 2021 *)
%o (Python)
%o from sympy import isprime, primerange
%o def comp(d, i): return d[:i] + str((10-int(d[i]))%10) + d[i+1:]
%o def ok(p):
%o d = str(p)
%o return all(isprime(int(comp(d, i))) for i in range(len(d)))
%o print(list(filter(ok, primerange(1, 95000)))) # _Michael S. Branicky_, Jun 20 2021
%Y Cf. A345343, A055120, A089740, A318785.
%K nonn,base,easy
%O 1,1
%A _Lamine Ngom_, Jun 20 2021
|