A378428 Composites that become prime when any two of their digits are deleted.
222, 225, 232, 235, 237, 252, 253, 255, 272, 273, 275, 322, 323, 325, 327, 332, 333, 335, 352, 355, 357, 372, 375, 377, 522, 525, 527, 532, 533, 535, 537, 552, 553, 555, 572, 573, 575, 722, 723, 725, 732, 735, 737, 752, 753, 755, 772, 775, 777, 1111, 1113, 1119, 1131, 1137, 1173, 1179, 1197, 1311, 1317, 1371
Offset: 1
Examples
1371 is in the sequence since upon deleting any two digits we get 13, 71, 17, 31, 11 and 37, all of which are prime. 1313 is not in the sequence since upon deleting the two 1s we get 33, which is not prime.
Programs
-
Mathematica
q[n_] := Module[{d = IntegerDigits[n]}, AllTrue[FromDigits /@ Subsets[d, {Length[d] - 2}], PrimeQ]]; Select[Range[100, 1500], CompositeQ[#] && q[#] &] (* Amiram Eldar, Nov 26 2024 *)
-
Python
from sympy import isprime from itertools import combinations as C def ok(n): if n < 100 or isprime(n): return False s = str(n) return all(isprime(int(t)) for i, j in C(range(len(s)), 2) if (t:=s[:i]+s[i+1:j]+s[j+1:])!="") print([k for k in range(1500) if ok(k)]) # Michael S. Branicky, Nov 26 2024
Comments