|
|
A319596
|
|
Base-3 deletable primes (written in base 10).
|
|
3
|
|
|
2, 5, 7, 11, 17, 19, 23, 29, 47, 53, 59, 61, 71, 73, 83, 89, 101, 107, 137, 167, 173, 179, 181, 191, 197, 223, 233, 251, 263, 269, 317, 431, 461, 491, 503, 509, 521, 541, 547, 557, 569, 587, 593, 653, 659, 673, 677, 683, 701, 709, 719, 809, 911, 947, 953
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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:
|
|
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[]]]];
|
|
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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
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
|
|
|
|