OFFSET
1,1
EXAMPLE
MATHEMATICA
lst={}; max=m=0; Do[If[!PrimeQ@n, If[IntegerQ[s=Max@Select[FromDigits/@Subsequences@IntegerDigits@n, PrimeQ]], m=s]]; If[m>max, max=m; AppendTo[lst, n]], {n, 10000}]; lst (* Giorgos Kalogeropoulos, Jun 25 2021 *)
PROG
(Python)
def trojan_composites(limit_maxval=None, limit_terms=None, verbose=True):
from sympy import isprime
num = 1
best = 0
found = []
while (not limit_maxval or num <= limit_maxval) and (not limit_terms or len(found) < limit_terms):
num += 1
if not isprime(num):
string = str(num)
for length in range(len(string), len(str(best)), -1):
candidate = max(filter(isprime, {int(string[i:i + length - 1]) for i in range(len(string) - length + 2)}), default=0)
if candidate:
if candidate > best:
best = candidate
found.append(num)
if verbose:
print(num, end=', ', flush=True)
break
if verbose:
print()
return found
trojan_composites(limit_terms=7) #[12, 15, 27, 110, 117, 119, 123]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eyal Gruss, Jun 21 2021
STATUS
approved