%I #17 Jan 30 2022 19:26:03
%S 2,3,5,7,13,17,29,31,43,47,59,67,71,79,83,97,127,157,163,269,271,359,
%T 383,439,457,463,487,509,547,569,571,643,659,683,701,709,751,769,863,
%U 929,983,1217,1427,1487,2069,2371,2609,2671,2689,2713,2731,2791,2969,3259
%N Rigidly-deletable primes: primes such that removing some digit, one at a time in unique order gives a prime at each step, until the empty string is reached.
%C Rigidly-deletable primes are deletable primes where the choice of digit to delete is unique (all other choices give nonprime numbers).
%C Leading zeros are allowed in the number that appears after the digit is deleted.
%H Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_138.htm">Puzzle 138. Deletable primes</a>, The Prime Puzzles and Problems Connection.
%e The prime 103 is not a member since removing a digit will either give 03 which has a leading zero (3 is a prime number), or give one of the numbers 13 which is prime, or 10 which is composite.
%e The prime 509 is a member since removing a digit will either give 09 which has a leading zero (9 is a composite number), or give one of the numbers 59 which is prime, or 50 which is composite. Then removing a digit from 59 will either give 9, or 5 which is prime.
%o (PARI) for(k=2, 3259, if(isprime(k), a=k; r=#digits(a); q=r; for(y=1, r, L=List([]); for(d=1, q, T=List(Vec(Str(a))); listpop(T, d); listput(L, concat(T))); t=0; for(b=1, q, w=L[b]; if(isprime(eval(w)), t++; u=w); if(t==2, break)); if(t==1, q=#Vec(u); a=u, break); if(y==r, print1(k, ", ")))));
%o (Python)
%o from sympy import isprime
%o def ok(n):
%o if not isprime(n): return False
%o if n < 10: return True
%o s, c, d = str(n), 0, None
%o for i in range(len(s)):
%o di = int(s[:i]+s[i+1:])
%o if isprime(di):
%o c += 1
%o if c > 1:
%o return False
%o d = di
%o return ok(d) and len(str(d)) == len(s) - 1
%o print([k for k in range(3260) if ok(k)]) # _Michael S. Branicky_, Dec 31 2021
%Y Cf. A080608, A188809.
%K nonn,base
%O 1,1
%A _Arkadiusz Wesolowski_, Dec 31 2021
|