A385404 Numbers that can be split into two at any place between their digits such that the resulting numbers are always a nonprime on the left and a prime on the right.
12, 13, 15, 17, 42, 43, 45, 47, 62, 63, 65, 67, 82, 83, 85, 87, 92, 93, 95, 97, 123, 143, 147, 153, 167, 183, 423, 443, 447, 453, 467, 483, 497, 623, 637, 643, 647, 653, 667, 683, 697, 813, 817, 823, 843, 847, 853, 867, 873, 883, 913, 917, 923, 937, 943, 947, 953, 967, 983, 997
Offset: 1
Examples
637 is a term because when it is split in two in all possible ways, it first results in 63, a nonprime, and 3, a prime. When split in the second and final possible way, it results in 6, a nonprime, and 37, a prime.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..7407
Programs
-
Mathematica
q[n_] := !MemberQ[IntegerDigits[n], 0] && AllTrue[Range[IntegerLength[n]-1], PrimeQ[QuotientRemainder[n, 10^#]] == {False, True} &]; Select[Range[10, 1000], q] (* Amiram Eldar, Jun 27 2025 *)
-
Python
from sympy import isprime def ok(n): return '0' not in (s:=str(n)) and len(s) > 1 and all(not isprime(int(s[:i])) and isprime(int(s[i:])) for i in range(1, len(s))) print([k for k in range(1000) if ok(k)]) # Michael S. Branicky, Jun 27 2025
-
Python
# uses import and function ok above from itertools import count, islice, product def agen(): # generator of terms tp = list("23579") # set of left-truncatable primes for d in count(2): tpnew = [] for f in "123456789": for e in tp: if isprime(int(s:=f+e)): tpnew.append(s) if ok(t:=int(f+e)): yield t tp = tpnew if len(tp) == 0: return afull = list(agen()) print(afull[:60]) # Michael S. Branicky, Jun 27 2025
Comments