login
Primes such that deleting some digit yields a prime.
38

%I #21 Jun 09 2024 13:20:12

%S 13,17,23,29,31,37,43,47,53,59,67,71,73,79,83,97,101,103,107,109,113,

%T 127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,

%U 223,229,233,239,241,263,269,271,283,293,307,311,313,317,331,337,347,353,359,367

%N Primes such that deleting some digit yields a prime.

%C Leading zeros are allowed in the number that appears after the digit is deleted, as in A080608. - _Michael S. Branicky_, Jan 28 2023

%H Michael S. Branicky, <a href="/A080603/b080603.txt">Table of n, a(n) for n = 1..10000</a>

%t Q@n_:=AnyTrue[FromDigits@Delete[IntegerDigits@n,#]&/@Range@IntegerLength@n, PrimeQ]; Select[Prime@Range@500, Q@# &] (* _Hans Rudolf Widmer_, Jun 09 2024 *)

%o (Python)

%o from sympy import isprime

%o def ok(n):

%o if n < 10 or not isprime(n): return False

%o s = str(n)

%o si = (s[:i]+s[i+1:] for i in range(len(s)))

%o return any(isprime(int(t)) for t in si)

%o print([k for k in range(368) if ok(k)]) # _Michael S. Branicky_, Jan 28 2023

%Y Cf. A080608, A096235-A096246.

%K nonn,easy,base

%O 1,1

%A _David W. Wilson_, Feb 25 2003