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.

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

This page as a plain text file.
%I A379944 #30 Jan 17 2025 03:38:36
%S A379944 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,
%T A379944 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,
%U A379944 1,1,2,2,0,2,5,1,1,0,4,2,2,1,1,2,1,1,1,1
%N A379944 Smallest number of leading digits of n! that form a prime (or 0 if none exist).
%C A379944 It appears that as n gets large, a(n) can become arbitrarily large.
%C A379944 It appears that values of n such that a(n) = 0 exist for arbitrarily large n.
%H A379944 Carson R. Smith, <a href="/A379944/b379944.txt">Table of n, a(n) for n = 0..2000</a>
%e A379944 For n = 3, 3! = 6, 6 is not prime, a(3) = 0.
%e A379944 For n = 19, 19! = 121645100408832000, 1216451 is the smallest prime, a(19) = 7.
%t A379944 A379944[n_] := Catch[Do[If[PrimeQ[FromDigits[#[[;; k]]]], Throw[k]],{k,Length[#]}] & [IntegerDigits[n!]]; 0];
%t A379944 Array[A379944, 100, 0] (* _Paolo Xausa_, Jan 16 2025 *)
%o A379944 (Python)
%o A379944 import math
%o A379944 from sympy import isprime
%o A379944 def a(n):
%o A379944     factorial = str(math.factorial(n))
%o A379944     for d in range(1, len(factorial)+1):
%o A379944         if isprime(int(factorial[:d])):
%o A379944             return d
%o A379944     return 0
%o A379944 (PARI) a(n) = my(d=digits(n!)); for (k=1, #d, if (isprime(fromdigits(Vec(d, k))), return(k))); \\ _Michel Marcus_, Jan 08 2025
%Y A379944 Cf. A000040, A000142, A046277.
%K A379944 nonn,base
%O A379944 0,13
%A A379944 _Carson R. Smith_, Jan 07 2025
%E A379944 More terms from _Jinyuan Wang_, Jan 07 2025