cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A385404 #20 Jun 27 2025 16:26:33
%S A385404 12,13,15,17,42,43,45,47,62,63,65,67,82,83,85,87,92,93,95,97,123,143,
%T A385404 147,153,167,183,423,443,447,453,467,483,497,623,637,643,647,653,667,
%U A385404 683,697,813,817,823,843,847,853,867,873,883,913,917,923,937,943,947,953,967,983,997
%N 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.
%C A385404 As no leading zeros are allowed, all terms are zeroless.
%C A385404 From _Michael S. Branicky_, Jun 27 2025: (Start)
%C A385404 Finite since each term with first digit removed must be a member of A024785, which is finite.
%C A385404 Last term here is a(7407) = 6357686312646216567629137. (End)
%H A385404 Michael S. Branicky, <a href="/A385404/b385404.txt">Table of n, a(n) for n = 1..7407</a>
%e A385404 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.
%t A385404 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 *)
%o A385404 (Python)
%o A385404 from sympy import isprime
%o A385404 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)))
%o A385404 print([k for k in range(1000) if ok(k)]) # _Michael S. Branicky_, Jun 27 2025
%o A385404 (Python) # uses import and function ok above
%o A385404 from itertools import count, islice, product
%o A385404 def agen():  # generator of terms
%o A385404     tp = list("23579")  # set of left-truncatable primes
%o A385404     for d in count(2):
%o A385404         tpnew = []
%o A385404         for f in "123456789":
%o A385404             for e in tp:
%o A385404                 if isprime(int(s:=f+e)):
%o A385404                     tpnew.append(s)
%o A385404                 if ok(t:=int(f+e)):
%o A385404                     yield t
%o A385404         tp = tpnew
%o A385404         if len(tp) == 0:
%o A385404             return
%o A385404 afull = list(agen())
%o A385404 print(afull[:60]) # _Michael S. Branicky_, Jun 27 2025
%Y A385404 Cf. A125664, A125524, A024785.
%K A385404 nonn,base,fini,full
%O A385404 1,1
%A A385404 _Tamas Sandor Nagy_, Jun 27 2025