login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A345667 a(n) is the largest prime substring of A345666(n). 1

%I #29 Jul 30 2021 09:18:32

%S 2,5,7,11,17,19,23,29,41,43,47,53,59,61,71,83,89,97,101,103,107,109,

%T 113,127,131,137,139,149,157,167,173,179,191,197,199,211,227,233,239,

%U 241,251,257,263,269,271,281,293,311,313,317,331,337,347,349,353,359

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

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

%t 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 *)

%o (Python)

%o def trojan_composites_records(limit_maxval=None, limit_terms=None, verbose=True):

%o from sympy import isprime

%o num = 1

%o found = []

%o while (not limit_maxval or not found or found[-1] <= limit_maxval) and (not limit_terms or len(found) < limit_terms):

%o num += 1

%o if not isprime(num):

%o string = str(num)

%o for length in range(len(string), len(str(found[-1])) if found else 1, -1):

%o candidate = max(filter(isprime, {int(string[i:i + length - 1]) for i in range(len(string) - length + 2)}), default=0)

%o if candidate:

%o if not found or candidate > found[-1]:

%o if limit_maxval and candidate > limit_maxval:

%o if verbose:

%o print()

%o return found

%o found.append(candidate)

%o if verbose:

%o print(candidate, end=', ', flush=True)

%o break

%o if verbose:

%o print()

%o return found

%o trojan_composites_records(limit_terms=7) # [2, 5, 7, 11, 17, 19, 23]

%Y Cf. A002808, A345666. Subset of A047814.

%K nonn,base

%O 1,1

%A _Eyal Gruss_, Jun 21 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 5 10:46 EDT 2024. Contains 372275 sequences. (Running on oeis4.)