login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A379944
Smallest number of leading digits of n! that form a prime (or 0 if none exist).
1
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,13
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.
LINKS
EXAMPLE
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.
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 *)
PROG
(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
(PARI) a(n) = my(d=digits(n!)); for (k=1, #d, if (isprime(fromdigits(Vec(d, k))), return(k))); \\ Michel Marcus, Jan 08 2025
CROSSREFS
KEYWORD
nonn,base,new
AUTHOR
Carson R. Smith, Jan 07 2025
EXTENSIONS
More terms from Jinyuan Wang, Jan 07 2025
STATUS
approved