OFFSET
1,1
COMMENTS
Digital complement of a digit d is 10-d if d > 0, 0 otherwise.
EXAMPLE
3829 is a term since 7829, 3229, 3889 and 3821 are all primes.
MATHEMATICA
q[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^4], q] (* Amiram Eldar, Jun 15 2021 *)
PROG
(Python)
from sympy import isprime
def comp(d, i): return d[:i] + str((10-int(d[i]))%10) + d[i+1:]
def ok(n):
d = str(n)
return all(isprime(int(comp(d, i))) for i in range(len(d)))
print(list(filter(ok, range(1, 11000)))) # Michael S. Branicky, Jun 14 2021
(PARI) f(x) = if (x, 10-x);
isok(m) = {my(d=digits(m)); for (i=1, #d, d[i] = f(d[i]); if (!isprime(fromdigits(d)), return (0)); d[i] = f(d[i]); ); return (1); } \\ Michel Marcus, Jun 15 2021
CROSSREFS
KEYWORD
nonn,base,easy,less
AUTHOR
Lamine Ngom, Jun 14 2021
STATUS
approved