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.

A125590 Largest n-digit base-10 deletable prime.

This page as a plain text file.
%I A125590 #30 Apr 03 2023 10:36:11
%S A125590 7,97,997,9973,99929,999907,9999907,99999307,999996671,9999996073,
%T A125590 99999966307,999999908773,9999999710639,99999999697769,
%U A125590 999999997160639,9999999996977699,99999999980803477,999999999961861807,9999999999961861807,99999999999807429133
%N A125590 Largest n-digit base-10 deletable prime.
%C A125590 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.
%C A125590 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.
%D A125590 C. Caldwell, Truncatable primes, J. Recreational Math., 19:1 (1987) 30-33. [Discusses left truncatable primes, right truncatable primes and deletable primes.]
%H A125590 I. O. Angell and H. J. Godwin, <a href="http://dx.doi.org/10.1090/S0025-5718-1977-0427213-2">On Truncatable Primes</a>, Math. Comput. 31, 265-267, 1977.
%H A125590 C. Caldwell, <a href="https://t5k.org/glossary/page.php?sort=DeletablePrime">Deletable primes</a>
%H A125590 Prime Curios, <a href="https://t5k.org/curios/page.php?curio_id=1420">A 300-digit example</a>
%H A125590 Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_138.htm">Puzzle 138: Deletable Primes</a>, Prime Puzzles and Problems Connection. [Includes a 500-digit example]
%H A125590 <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a>
%e A125590 99929 -> 9929 -> 929 -> 29 -> 2.
%t A125590 b = 10; a = {7}; d = {2, 3, 5, 7};
%t A125590 For[n = 2, n <= 5, n++,
%t A125590   p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];
%t A125590   For[i = 1, i <= Length[p], i++,
%t A125590    c = IntegerDigits[p[[i]], b];
%t A125590    For[j = 1, j <= n, j++,
%t A125590     t = Delete[c, j];
%t A125590     If[t[[1]] == 0, Continue[]];
%t A125590     If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
%t A125590   AppendTo[a, Last[d]]];
%t A125590 a (* _Robert Price_, Nov 13 2018 *)
%o A125590 (Python)
%o A125590 from sympy import isprime, prevprime
%o A125590 from functools import cache
%o A125590 @cache
%o A125590 def deletable_prime(n):
%o A125590     if not isprime(n): return False
%o A125590     if n < 10: return True
%o A125590     s = str(n)
%o A125590     si = (s[:i]+s[i+1:] for i in range(len(s)))
%o A125590     return any(t[0] != '0' and deletable_prime(int(t)) for t in si)
%o A125590 def a(n):
%o A125590     p = prevprime(10**n)
%o A125590     while not deletable_prime(p): p = prevprime(p)
%o A125590     return p
%o A125590 print([a(n) for n in range(1, 15)]) # _Michael S. Branicky_, Jan 13 2022
%Y A125590 Cf. A080608, A096243, A096246, A125589.
%K A125590 nonn,base
%O A125590 1,1
%A A125590 _N. J. A. Sloane_, Jan 07 2007
%E A125590 a(6)-a(8) from _Michael Kleber_, Jan 08 2007
%E A125590 a(9)-a(16) from _Joshua Zucker_, May 11 2007
%E A125590 a(17)-a(20) from _Michael S. Branicky_, Jan 13 2022