Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #54 Jan 14 2022 10:34:35
%S 2,5,7,11,17,19,23,29,47,53,59,61,71,73,83,89,101,107,137,167,173,179,
%T 181,191,197,223,233,251,263,269,317,431,461,491,503,509,521,541,547,
%U 557,569,587,593,653,659,673,677,683,701,709,719,809,911,947,953
%N Base-3 deletable primes (written in base 10).
%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.
%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.
%H Robert Israel, <a href="/A319596/b319596.txt">Table of n, a(n) for n = 1..10000</a> (first 177 terms from Robert Price)
%p S:= {2}: count:= 0:
%p p:= 2;
%p while count < 200 do
%p p:= nextprime(p);
%p d:= floor(log[3](p));
%p for i from 0 to d do
%p x:= p mod 3^(i+1);
%p q:= (x mod 3^i) + (p-x)/3;
%p if q >= 3^(d-1) and member(q,S) then
%p S:= S union {p}; count:= count+1; break
%p fi
%p od;
%p od:
%p sort(convert(S,list)); # _Robert Israel_, Nov 26 2020
%t b = 3; d = {};
%t p = Select[Range[2, 10000], PrimeQ[#] &];
%t For[i = 1, i <= Length[p], i++,
%t c = IntegerDigits[p[[i]], b];
%t If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
%t For[j = 1, j <= Length[c], 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 d (* _Robert Price_, Dec 05 2018 *)
%o (Python)
%o from sympy import isprime
%o from sympy.ntheory.digits import digits
%o def ok(n, base=3):
%o if not isprime(n): return False
%o if n < 3: return True
%o s = "".join(str(d) for d in digits(n, base)[1:])
%o si = (s[:i]+s[i+1:] for i in range(len(s)))
%o return any(t[0] != '0' and ok(int(t, base)) for t in si)
%o print([k for k in range(954) if ok(k)]) # _Michael S. Branicky_, Jan 14 2022
%Y Cf. A080608, A080603, A096235-A096246.
%K nonn,base,easy
%O 1,1
%A _Robert Price_, Nov 14 2018
%E 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