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.

A345666 Composite numbers whose largest prime substring is greater than the record of all previous terms.

This page as a plain text file.
%I A345666 #27 Jul 30 2021 09:17:22
%S A345666 12,15,27,110,117,119,123,129,141,143,147,153,159,161,171,183,189,297,
%T A345666 1010,1030,1070,1090,1113,1127,1131,1137,1139,1149,1157,1167,1173,
%U A345666 1179,1191,1197,1199,1211,1227,1233,1239,1241,1251,1257,1263,1269,1271,1281,1293
%N A345666 Composite numbers whose largest prime substring is greater than the record of all previous terms.
%e A345666 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.
%t A345666 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 *)
%o A345666 (Python)
%o A345666 def trojan_composites(limit_maxval=None, limit_terms=None, verbose=True):
%o A345666     from sympy import isprime
%o A345666     num = 1
%o A345666     best = 0
%o A345666     found = []
%o A345666     while (not limit_maxval or num <= limit_maxval) and (not limit_terms or len(found) < limit_terms):
%o A345666         num += 1
%o A345666         if not isprime(num):
%o A345666             string = str(num)
%o A345666             for length in range(len(string), len(str(best)), -1):
%o A345666                 candidate = max(filter(isprime, {int(string[i:i + length - 1]) for i in range(len(string) - length + 2)}), default=0)
%o A345666                 if candidate:
%o A345666                     if candidate > best:
%o A345666                         best = candidate
%o A345666                         found.append(num)
%o A345666                         if verbose:
%o A345666                             print(num, end=', ', flush=True)
%o A345666                 break
%o A345666     if verbose:
%o A345666         print()
%o A345666     return found
%o A345666 trojan_composites(limit_terms=7) #[12, 15, 27, 110, 117, 119, 123]
%Y A345666 Cf. A002808, A047814, A345667 (corresponding prime substrings).
%K A345666 nonn,base
%O A345666 1,1
%A A345666 _Eyal Gruss_, Jun 21 2021