OFFSET
1,1
COMMENTS
If you start from a one-digit prime, you can try to build larger and larger deletable primes by inserting digits. If at one point you get stuck and cannot enlarge the number, you have reached a non-insertable prime (A125001). - Jeppe Stig Nielsen, Mar 28 2021
LINKS
Jeppe Stig Nielsen, Table of n, a(n) for n = 1..10000
EXAMPLE
2003 is not a member since removing a digit will either give 003 which has a leading zero, or give one of the numbers 203 or 200 which are both composite. However, 2003 is in A080608 because all of 2003, 003, 03, 3 are prime.
MATHEMATICA
Rest@ Union@ Nest[Function[{a, p}, Append[a, With[{w = IntegerDigits[p]}, If[# == True, p, 0] &@ AnyTrue[Array[If[First@ # == 0, 1, FromDigits@ #] &@ Delete[w, #] &, Length@ w], ! FreeQ[a, #] &]]]] @@ {#, Prime[Length@ # + 1]} &, Prime@ Range@ PrimePi@ 10, 81] (* Michael De Vlieger, Aug 02 2018 *)
PROG
(PARI) is(n) = !ispseudoprime(n)&&return(0); my(d=digits(n)); #d==1&&return(1); for(i=1, #d, my(v=vecextract(d, Str("^"i))); v[1]!=0&&is(fromdigits(v))&&return(1)); 0
(Python)
from sympy import isprime
def ok(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 ok(int(t)) for t in si)
print([k for k in range(440) if ok(k)]) # Michael S. Branicky, Jan 28 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jeppe Stig Nielsen, Aug 01 2018
STATUS
approved