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.

A125589 Smallest n-digit base-10 deletable prime.

Original entry on oeis.org

2, 13, 103, 1013, 10039, 100103, 1000193, 10000931, 100001903, 1000003957, 10000003957, 100000013957, 1000000030957, 10000000301957, 100000000730957, 1000000000730957, 10000000003632979, 100000000007309357
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2007

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime. "Digit" means digit in base b.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Crossrefs

Programs

  • Mathematica
    b = 10; a = {2}; d = {2, 3, 5, 7};
    For[n = 2, n <= 6, n++,
      found = False;
      p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
      For[i = 1, i <= Length[p], i++,
       c = IntegerDigits[p[[i]], b];
       For[j = 1, j <= n, j++,
        t = Delete[c, j];
        If[t[[1]] == 0, Continue[]];
        If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]];
         If[! found , AppendTo[a, p[[i]]]]; found = True; Break[]]];
    ]]; a (* Robert Price, Nov 13 2018 *)

Extensions

a(6) - a(8) from Michael Kleber, Jan 08 2007
a(9) - a(14) from Phil Carmody, Jan 09 2007
a(15) - a(18) from Joshua Zucker, Jan 09 2007

A125590 Largest n-digit base-10 deletable prime.

Original entry on oeis.org

7, 97, 997, 9973, 99929, 999907, 9999907, 99999307, 999996671, 9999996073, 99999966307, 999999908773, 9999999710639, 99999999697769, 999999997160639, 9999999996977699, 99999999980803477, 999999999961861807, 9999999999961861807, 99999999999807429133
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2007

Keywords

Comments

A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime. "Digit" means digit in base b.
Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.

Examples

			99929 -> 9929 -> 929 -> 29 -> 2.
		

References

  • C. Caldwell, Truncatable primes, J. Recreational Math., 19:1 (1987) 30-33. [Discusses left truncatable primes, right truncatable primes and deletable primes.]

Crossrefs

Programs

  • Mathematica
    b = 10; a = {7}; d = {2, 3, 5, 7};
    For[n = 2, n <= 5, n++,
      p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
      For[i = 1, i <= Length[p], i++,
       c = IntegerDigits[p[[i]], b];
       For[j = 1, j <= n, j++,
        t = Delete[c, j];
        If[t[[1]] == 0, Continue[]];
        If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
      AppendTo[a, Last[d]]];
    a (* Robert Price, Nov 13 2018 *)
  • Python
    from sympy import isprime, prevprime
    from functools import cache
    @cache
    def deletable_prime(n):
        if not isprime(n): return False
        if n < 10: return True
        s = str(n)
        si = (s[:i]+s[i+1:] for i in range(len(s)))
        return any(t[0] != '0' and deletable_prime(int(t)) for t in si)
    def a(n):
        p = prevprime(10**n)
        while not deletable_prime(p): p = prevprime(p)
        return p
    print([a(n) for n in range(1, 15)]) # Michael S. Branicky, Jan 13 2022

Extensions

a(6)-a(8) from Michael Kleber, Jan 08 2007
a(9)-a(16) from Joshua Zucker, May 11 2007
a(17)-a(20) from Michael S. Branicky, Jan 13 2022
Showing 1-2 of 2 results.