login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A345343 Numbers that yield a prime when any single digit is replaced by its digital complement. 1
3, 5, 7, 8, 17, 33, 39, 47, 63, 71, 77, 93, 107, 171, 177, 221, 223, 287, 333, 339, 401, 441, 447, 699, 823, 827, 857, 883, 999, 1421, 1781, 2087, 2089, 2171, 2233, 2539, 3253, 3829, 3963, 4007, 4173, 4977, 5051, 5059, 5503, 5507, 6363, 7217, 7491, 7541, 8447, 10247 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Digital complement of a digit d is 10-d if d > 0, 0 otherwise.

LINKS

Table of n, a(n) for n=1..52.

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

Cf. A055120, A089740, A318785.

Sequence in context: A039003 A229860 A081453 * A200655 A249439 A276693

Adjacent sequences:  A345340 A345341 A345342 * A345344 A345345 A345346

KEYWORD

nonn,base,easy,less

AUTHOR

Lamine Ngom, Jun 14 2021

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 16:31 EDT 2021. Contains 347598 sequences. (Running on oeis4.)