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-3 of 3 results.

A046276 Largest palindromic substring in n! without an initial zero.

Original entry on oeis.org

1, 1, 2, 6, 4, 2, 7, 5, 4, 88, 88, 99, 9, 22, 87178, 767, 898, 55, 737, 121, 66, 909, 7777, 25852, 484, 1551, 66, 8888, 888, 93739, 848, 82228, 353, 881188, 414, 6666, 999, 59795, 1111, 99, 69596, 61316, 4260624, 383, 8448, 7337, 89498, 979, 67776, 828
Offset: 0

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Examples

			14! = {87178}291200.
		

Crossrefs

Cf. A046277.

Programs

  • Mathematica
    isPal[d_List] := d[[1]] != 0 && d == Reverse[d]; Table[d = IntegerDigits[n!]; k = Length[d]; While[s = Select[Partition[d, k, 1], isPal]; s == {}, k--]; Max[FromDigits /@ s], {n, 0, 100}] (* T. D. Noe, Mar 25 2011 *)

Extensions

Corrected by D. S. McNeil, Dec 10 2010

A379944 Smallest number of leading digits of n! that form a prime (or 0 if none exist).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 2, 0, 0, 2, 1, 1, 0, 7, 1, 1, 2, 1, 0, 5, 0, 0, 1, 8, 1, 0, 1, 6, 1, 3, 1, 2, 1, 1, 0, 1, 8, 38, 1, 2, 1, 1, 5, 34, 1, 5, 6, 0, 1, 0, 1, 6, 1, 2, 2, 1, 1, 2, 8, 9, 1, 1, 1, 2, 2, 0, 2, 5, 1, 1, 0, 4, 2, 2, 1, 1, 2, 1, 1, 1, 1
Offset: 0

Views

Author

Carson R. Smith, Jan 07 2025

Keywords

Comments

It appears that as n gets large, a(n) can become arbitrarily large.
It appears that values of n such that a(n) = 0 exist for arbitrarily large n.

Examples

			For n = 3, 3! = 6, 6 is not prime, a(3) = 0.
For n = 19, 19! = 121645100408832000, 1216451 is the smallest prime, a(19) = 7.
		

Crossrefs

Programs

  • Mathematica
    A379944[n_] := Catch[Do[If[PrimeQ[FromDigits[#[[;; k]]]], Throw[k]],{k,Length[#]}] & [IntegerDigits[n!]]; 0];
    Array[A379944, 100, 0] (* Paolo Xausa, Jan 16 2025 *)
  • PARI
    a(n) = my(d=digits(n!)); for (k=1, #d, if (isprime(fromdigits(Vec(d, k))), return(k))); \\ Michel Marcus, Jan 08 2025
  • Python
    import math
    from sympy import isprime
    def a(n):
        factorial = str(math.factorial(n))
        for d in range(1, len(factorial)+1):
            if isprime(int(factorial[:d])):
                return d
        return 0
    

Extensions

More terms from Jinyuan Wang, Jan 07 2025

A052056 Numbers k such that k! starts with its largest prime substring.

Original entry on oeis.org

2, 4, 6, 7, 9, 10, 15, 16, 20, 21, 23, 25, 30, 35, 43, 78, 102, 105, 132, 138, 151, 189, 202, 215, 219, 233, 241, 264, 320, 334, 349, 352, 367, 386, 433, 458, 520, 583, 779, 885, 905, 1068, 1078, 1131, 1149, 1198, 1271, 1276, 1314, 1503, 1623, 1646, 1903, 1962, 2053
Offset: 1

Views

Author

Patrick De Geest, Jan 15 2000

Keywords

Examples

			16 is a term because 16! = {209227}89888000 and its largest prime substring 209227 starts from the left.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def starts_with_lps(n): # see link for faster version
        s = str(n)
        ss = (s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1))
        lps = max((u for u in (int(t) for t in ss) if isprime(u)), default=0)
        return lps > 0 and s.startswith(str(lps))
    def afind():
        k, fk = 1, 1
        while True:
            if starts_with_lps(fk):
                print(k, end=", ")
            k += 1
            fk *= k
    afind() # Michael S. Branicky, Dec 31 2021

Extensions

More terms from Sean A. Irvine, Feb 16 2011
Offset changed to 1 by Jon E. Schoenfield, Oct 17 2019
a(38)-a(49) from Michael S. Branicky, Dec 31 2021
a(50)-a(55) from Michael S. Branicky, May 31 2023
Showing 1-3 of 3 results.