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.

Showing 1-2 of 2 results.

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

Original entry on oeis.org

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
Offset: 1

Views

Author

Lamine Ngom, Jun 14 2021

Keywords

Comments

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

Examples

			3829 is a term since 7829, 3229, 3889 and 3821 are all primes.
		

Crossrefs

Programs

  • 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 *)
  • 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
  • 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
    

A345529 Primes that yield a prime when any single digit is replaced by its 10's complement.

Original entry on oeis.org

3, 5, 7, 17, 47, 71, 107, 223, 401, 823, 827, 857, 883, 2087, 2089, 2539, 3253, 4007, 5051, 5059, 5503, 5507, 7541, 8447, 10247, 12401, 18041, 25303, 33529, 33589, 35533, 40427, 44171, 45557, 53503, 53653, 53899, 54401, 55001, 55009, 55333, 55817, 57077, 71147, 81017, 82003, 93553
Offset: 1

Views

Author

Lamine Ngom, Jun 20 2021

Keywords

Comments

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

Examples

			71147 is a term since 31147, 79147, 71947, 71167 and 71143 are all primes.
		

Crossrefs

Programs

  • Mathematica
    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 *)
  • Python
    from sympy import isprime, primerange
    def comp(d, i): return d[:i] + str((10-int(d[i]))%10) + d[i+1:]
    def ok(p):
        d = str(p)
        return all(isprime(int(comp(d, i))) for i in range(len(d)))
    print(list(filter(ok, primerange(1, 95000)))) # Michael S. Branicky, Jun 20 2021
Showing 1-2 of 2 results.