login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A345666
Composite numbers whose largest prime substring is greater than the record of all previous terms.
1
12, 15, 27, 110, 117, 119, 123, 129, 141, 143, 147, 153, 159, 161, 171, 183, 189, 297, 1010, 1030, 1070, 1090, 1113, 1127, 1131, 1137, 1139, 1149, 1157, 1167, 1173, 1179, 1191, 1197, 1199, 1211, 1227, 1233, 1239, 1241, 1251, 1257, 1263, 1269, 1271, 1281, 1293
OFFSET
1,1
EXAMPLE
a(1)=12 is the first composite containing a prime substring. Its largest prime substring is A345667(1)=2. It is the first nonzero composite index of A047814.
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
Cf. A002808, A047814, A345667 (corresponding prime substrings).
Sequence in context: A357867 A350807 A124521 * A369005 A134221 A179148
KEYWORD
nonn,base
AUTHOR
Eyal Gruss, Jun 21 2021
STATUS
approved