OFFSET
1,2
COMMENTS
The substring may not start with digit 0.
Also, a generalization of the condition in A131648 to every multi-digit substring is prime with respect to 2, 3, 5, 7.
Sequence is finite with a(104) = 67379 the final term.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..104
FORMULA
{n | A387819(n) = n}.
EXAMPLE
113 is a term because all its substrings of length greater than 1 are prime numbers.
PROG
(Python)
def children2357(s):
return set(int(s[:i]+str(q//d)+s[j:]) for i in range(len(s)-1) for j in range(i+2, len(s)+1) if (w:=s[i:j])[0]!='0' for d in [2, 3, 5, 7] if (q:=int(w))%d==0)
def ok(n): return n > 10 and len(children2357(str(n))) == 0
print([k for k in range(1, 10**5) if ok(k)])
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Michael S. Branicky and Ali Sada, Oct 12 2025
STATUS
approved
