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.

Showing 1-8 of 8 results.

A046277 Largest prime substring in n! (0 if none).

Original entry on oeis.org

0, 0, 2, 0, 2, 2, 7, 5, 3, 3, 3, 991, 9001, 227, 8291, 1307, 209227, 68742809, 4023737, 164510040883, 24329020081, 510909421717, 1240007, 258520167388849, 4840173323, 155112100433309, 9146112660563, 694504183521607, 8344611713860501, 6199373970195454361
Offset: 0

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Examples

			22! = 1{1240007}27777607680000.
		

Crossrefs

Programs

  • Maple
    a:= n-> (s-> max(0, select(isprime, {seq(seq(parse(
        s[i..j]), i=1..j), j=1..length(s))})))(""||(n!)):
    seq(a(n), n=0..30);  # Alois P. Heinz, Jan 16 2025
  • Mathematica
    A046277[n_] := Module[{d = IntegerDigits[n!/10^IntegerExponent[n!, 10]], len, s}, len = Length[d]; While[len > 0 && (s = Select[Map[FromDigits, Partition[d, len, 1]], IntegerLength[#] == len && PrimeQ[#] &]) == {}, len--]; Max[0, s]];
    Array[A046277, 30, 0] (* Paolo Xausa, Jan 16 2025 *)

Formula

a(n) = A047814(A000142(n)). - Pontus von Brömssen, Jan 16 2025

Extensions

a(28)-a(29) from Pontus von Brömssen, Jan 16 2025

A046268 Largest prime substring in 2^n (or 0 if none exist).

Original entry on oeis.org

0, 2, 0, 0, 0, 3, 0, 2, 5, 5, 2, 2, 409, 19, 163, 7, 6553, 131, 2621, 5, 857, 971, 419, 83, 1677721, 5443, 71, 1342177, 43, 709, 107, 83, 4294967, 89, 171798691, 3597383, 6871947673, 3743895347, 779069, 54975581, 511627, 99023, 4398046511, 79609, 18604441, 883
Offset: 0

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Examples

			2^37 = 1{3743895347}2, so a(37) = 3743895347.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def a(n):
        s = str(2**n)
        ss = (int(s[i:j]) for i in range(len(s)) for j in range(i+1, len(s)+1))
        return max((k for k in ss if isprime(k)), default=0)
    print([a(n) for n in range(46)]) # Michael S. Branicky, Sep 20 2022

Formula

a(n) = A047814(2^n). - Pontus von Brömssen, Jan 16 2025

Extensions

a(44) and beyond from Michael S. Branicky, Sep 20 2022

A331097 a(n) is the greatest prime number of the form n mod (10^k) for some k > 0, or 0 if no such prime number exists.

Original entry on oeis.org

0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 2, 13, 0, 5, 0, 17, 0, 19, 0, 0, 2, 23, 0, 5, 0, 7, 0, 29, 0, 31, 2, 3, 0, 5, 0, 37, 0, 0, 0, 41, 2, 43, 0, 5, 0, 47, 0, 0, 0, 0, 2, 53, 0, 5, 0, 7, 0, 59, 0, 61, 2, 3, 0, 5, 0, 67, 0, 0, 0, 71, 2, 73, 0, 5, 0, 7, 0, 79, 0
Offset: 0

Views

Author

Rémy Sigrist, Jan 09 2020

Keywords

Comments

In other words, a(n) is the largest prime suffix of n, or 0 if no such suffix exists.

Examples

			For n = 42:
- 42 mod (10^k) = 42 is not prime for k >= 2,
- 42 mod 10 = 2 is prime,
- hence a(42) = 2.
		

Crossrefs

Cf. A047814, A331044, A331102 (binary analog).

Programs

  • PARI
    a(n,base=10) = my (d=digits(n, base), s); for (k=1, #d, if (isprime(s=fromdigits(d[k..#d], base)), return (s))); 0

Formula

a(n) <= n with equality iff n = 0 or n is a prime number.

A211396 Smallest prime substring of n, or 0 if no such substring exists.

Original entry on oeis.org

0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 2, 3, 0, 5, 0, 7, 0, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 0, 41, 2, 3, 0, 5, 0, 7, 0, 0, 5, 5, 2, 3, 5, 5, 5, 5, 5, 5, 0, 61, 2, 3, 0, 5, 0, 7, 0, 0, 7, 7, 2, 3, 7, 5, 7, 7, 7, 7, 0, 0, 2, 3, 0, 5
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 08 2013

Keywords

Comments

a(n) <= A047814(n);
a(n) = 0 iff A039997(n) = 0, cf. A062115;
a(n) = n iff n is prime and A039997(n) = 1.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a211396 n = if null ips then 0 else head ips
       where ips = [p | p <- takeWhile (<= n) a000040_list,
                        show p `isInfixOf` show n]

A135580 Largest prime visible as a substring of 10n+3.

Original entry on oeis.org

3, 13, 23, 3, 43, 53, 3, 73, 83, 3, 103, 113, 23, 13, 43, 53, 163, 173, 83, 193, 3, 13, 223, 233, 43, 53, 263, 73, 283, 293, 3, 313, 23, 3, 43, 353, 3, 373, 383, 3, 3, 41, 23, 433, 443, 53, 463, 73, 83, 3, 503, 13, 523, 53, 43, 53, 563, 73, 83, 593, 3, 613, 23, 3, 643, 653, 3
Offset: 0

Views

Author

Zak Seidov, Feb 24 2008

Keywords

Examples

			a(0) = 3 because 10 * 0 + 3 = 3 (prime),
a(1) = 13 because 10 * 1 + 3 = 13 (prime),
a(3) = 3 because 10 * 3 + 3 = 33 (composite). Substrings of 33 are 0, 3, 33 and the largest  prime of these is 3.
a(78) = 83 because 10 * 78 + 3 = 783 (composite). The largest prime substring is 83.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Max[Select[FromDigits/@Subsequences[IntegerDigits[10n+3]],PrimeQ]] (* James C. McMahon, Apr 16 2025 *)

Formula

a(n) = A047814(A017305(n)). - Michel Marcus, Apr 16 2025

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

Views

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]

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

Views

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]

A075083 Largest composite number formed by permuting the digits of n, or 0 if no such number exists.

Original entry on oeis.org

0, 0, 0, 4, 0, 6, 0, 8, 9, 10, 0, 21, 0, 14, 51, 16, 0, 81, 91, 20, 21, 22, 32, 42, 52, 62, 72, 82, 92, 30, 0, 32, 33, 34, 35, 63, 0, 38, 93, 40, 14, 42, 34, 44, 54, 64, 74, 84, 94, 50, 51, 52, 35, 54, 55, 65, 75, 85, 95, 60, 16, 62, 63, 64, 65, 66, 76, 86, 96, 70, 0, 72, 0, 74, 75
Offset: 1

Views

Author

Amarnath Murthy, Sep 11 2002

Keywords

Crossrefs

Cf. A047814.

Programs

  • Mathematica
    Table[Max[Select[FromDigits/@Permutations[IntegerDigits[n]], CompositeQ]],{n,80}]/.(-\[Infinity]->0) (* Harvey P. Dale, Feb 14 2016 *)

Extensions

More terms from David Wasserman, Jan 16 2005
Showing 1-8 of 8 results.