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.

User: Eyal Gruss

Eyal Gruss's wiki page.

Eyal Gruss has authored 2 sequences.

A345667 a(n) is the largest prime substring of A345666(n).

Original entry on oeis.org

2, 5, 7, 11, 17, 19, 23, 29, 41, 43, 47, 53, 59, 61, 71, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 157, 167, 173, 179, 191, 197, 199, 211, 227, 233, 239, 241, 251, 257, 263, 269, 271, 281, 293, 311, 313, 317, 331, 337, 347, 349, 353, 359
Offset: 1

Author

Eyal Gruss, Jun 21 2021

Keywords

Examples

			a(4) = 11 is the largest prime substring of A345666(4) = 110.
		

Crossrefs

Cf. A002808, A345666. Subset of A047814.

Programs

  • 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,s]],{n,10000}];lst (* Giorgos Kalogeropoulos, Jun 25 2021 *)
  • Python
    def trojan_composites_records(limit_maxval=None, limit_terms=None, verbose=True):
        from sympy import isprime
        num = 1
        found = []
        while (not limit_maxval or not found or found[-1] <= 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(found[-1])) if found else 1, -1):
                    candidate = max(filter(isprime, {int(string[i:i + length - 1]) for i in range(len(string) - length + 2)}), default=0)
                    if candidate:
                        if not found or candidate > found[-1]:
                            if limit_maxval and candidate > limit_maxval:
                                if verbose:
                                    print()
                                return found
                            found.append(candidate)
                            if verbose:
                                print(candidate, end=', ', flush=True)
                    break
        if verbose:
            print()
        return found
    trojan_composites_records(limit_terms=7) # [2, 5, 7, 11, 17, 19, 23]

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

Original entry on oeis.org

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

Author

Eyal Gruss, Jun 21 2021

Keywords

Examples

			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.
		

Crossrefs

Cf. A002808, A047814, A345667 (corresponding prime substrings).

Programs

  • 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 *)
  • 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]