The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A125590 Largest n-digit base-10 deletable prime. 1

%I #30 Apr 03 2023 10:36:11

%S 7,97,997,9973,99929,999907,9999907,99999307,999996671,9999996073,

%T 99999966307,999999908773,9999999710639,99999999697769,

%U 999999997160639,9999999996977699,99999999980803477,999999999961861807,9999999999961861807,99999999999807429133

%N Largest n-digit base-10 deletable prime.

%C 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 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 C. Caldwell, Truncatable primes, J. Recreational Math., 19:1 (1987) 30-33. [Discusses left truncatable primes, right truncatable primes and deletable primes.]

%H 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 C. Caldwell, <a href="https://t5k.org/glossary/page.php?sort=DeletablePrime">Deletable primes</a>

%H Prime Curios, <a href="https://t5k.org/curios/page.php?curio_id=1420">A 300-digit example</a>

%H 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 <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a>

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

%t b = 10; a = {7}; d = {2, 3, 5, 7};

%t For[n = 2, n <= 5, n++,

%t p = Select[Range[b^(n - 1), b^n - 1], PrimeQ[#] &];

%t For[i = 1, i <= Length[p], i++,

%t c = IntegerDigits[p[[i]], b];

%t For[j = 1, j <= n, j++,

%t t = Delete[c, j];

%t If[t[[1]] == 0, Continue[]];

%t If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];

%t AppendTo[a, Last[d]]];

%t a (* _Robert Price_, Nov 13 2018 *)

%o (Python)

%o from sympy import isprime, prevprime

%o from functools import cache

%o @cache

%o def deletable_prime(n):

%o if not isprime(n): return False

%o if n < 10: return True

%o s = str(n)

%o si = (s[:i]+s[i+1:] for i in range(len(s)))

%o return any(t[0] != '0' and deletable_prime(int(t)) for t in si)

%o def a(n):

%o p = prevprime(10**n)

%o while not deletable_prime(p): p = prevprime(p)

%o return p

%o print([a(n) for n in range(1, 15)]) # _Michael S. Branicky_, Jan 13 2022

%Y Cf. A080608, A096243, A096246, A125589.

%K nonn,base

%O 1,1

%A _N. J. A. Sloane_, Jan 07 2007

%E a(6)-a(8) from _Michael Kleber_, Jan 08 2007

%E a(9)-a(16) from _Joshua Zucker_, May 11 2007

%E a(17)-a(20) from _Michael S. Branicky_, Jan 13 2022

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 25 22:07 EDT 2024. Contains 372806 sequences. (Running on oeis4.)