OFFSET
1,1
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.
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.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000 (first 177 terms from Robert Price)
MAPLE
S:= {2}: count:= 0:
p:= 2;
while count < 200 do
p:= nextprime(p);
d:= floor(log[3](p));
for i from 0 to d do
x:= p mod 3^(i+1);
q:= (x mod 3^i) + (p-x)/3;
if q >= 3^(d-1) and member(q, S) then
S:= S union {p}; count:= count+1; break
fi
od;
od:
sort(convert(S, list)); # Robert Israel, Nov 26 2020
MATHEMATICA
b = 3; d = {};
p = Select[Range[2, 10000], PrimeQ[#] &];
For[i = 1, i <= Length[p], i++,
c = IntegerDigits[p[[i]], b];
If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
For[j = 1, j <= Length[c], j++,
t = Delete[c, j];
If[t[[1]] == 0, Continue[]];
If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
d (* Robert Price, Dec 05 2018 *)
PROG
(Python)
from sympy import isprime
from sympy.ntheory.digits import digits
def ok(n, base=3):
if not isprime(n): return False
if n < 3: return True
s = "".join(str(d) for d in digits(n, base)[1:])
si = (s[:i]+s[i+1:] for i in range(len(s)))
return any(t[0] != '0' and ok(int(t, base)) for t in si)
print([k for k in range(954) if ok(k)]) # Michael S. Branicky, Jan 14 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Robert Price, Nov 14 2018
EXTENSIONS
Removed the term 3. As pointed out by Kevin Ryde, there is no need to "seed" the list using base-2 assumptions. - Robert Price, Dec 05 2018
STATUS
approved