cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A345343 Numbers that yield a prime when any single digit is replaced by its digital complement.

This page as a plain text file.
%I A345343 #27 Jul 21 2021 09:32:32
%S A345343 3,5,7,8,17,33,39,47,63,71,77,93,107,171,177,221,223,287,333,339,401,
%T A345343 441,447,699,823,827,857,883,999,1421,1781,2087,2089,2171,2233,2539,
%U A345343 3253,3829,3963,4007,4173,4977,5051,5059,5503,5507,6363,7217,7491,7541,8447,10247
%N A345343 Numbers that yield a prime when any single digit is replaced by its digital complement.
%C A345343 Digital complement of a digit d is 10-d if d > 0, 0 otherwise.
%e A345343 3829 is a term since 7829, 3229, 3889 and 3821 are all primes.
%t A345343 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 *)
%o A345343 (Python)
%o A345343 from sympy import isprime
%o A345343 def comp(d, i): return d[:i] + str((10-int(d[i]))%10) + d[i+1:]
%o A345343 def ok(n):
%o A345343     d = str(n)
%o A345343     return all(isprime(int(comp(d, i))) for i in range(len(d)))
%o A345343 print(list(filter(ok, range(1, 11000)))) # _Michael S. Branicky_, Jun 14 2021
%o A345343 (PARI) f(x) = if (x, 10-x);
%o A345343 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
%Y A345343 Cf. A055120, A089740, A318785.
%K A345343 nonn,base,easy,less
%O A345343 1,1
%A A345343 _Lamine Ngom_, Jun 14 2021