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.

A228311 Numbers k such that the sum of digits of k! is itself a factorial.

This page as a plain text file.
%I A228311 #95 Mar 19 2025 10:23:06
%S A228311 0,1,2,3,4,21966,176755,182624820
%N A228311 Numbers k such that the sum of digits of k! is itself a factorial.
%C A228311 The sum of digits of k! is approximately (9/2)*(d-z), where d=A034886(k) is the number of digits of k!, which is about (log(k/E)*k + log(2*k*Pi)/2)/log(10), and z=A027868(k) is the number of trailing zeros of k!, which is Sum_{j>=1} floor(k/5^j). - _Giovanni Resta_, Aug 28 2013
%C A228311 a(9) > 2.235*10^9. - _Hans Havermann_, May 16 2014
%C A228311 k! has ~ k log_10(k) digits, so its digit sum is typically close to C*k*log_10(k) for some constant C. A random number around j has probability something like log(j)/(j log log(j)) of being a factorial, so the probability that the digit sum of k! is a factorial should be something like const/(k log log k). The sum of this diverges, so we should expect infinitely many terms in the sequence. - _Robert Israel_, Aug 08 2014
%H A228311 Shyam Sunder Gupta, <a href="https://doi.org/10.1007/978-981-97-2465-9_16">Fascinating Factorials</a>, Exploring the Beauty of Fascinating Numbers, Springer (2025) Ch. 16, 411-442.
%H A228311 "Mouhaha" <a href="http://www.mymathforum.com/viewtopic.php?p=164005#p164005">Digit sums and factorials</a>
%e A228311 The sum of the digits of 21966! is 362880 = 9!.
%e A228311 The sum of the digits of 176755! is 3628800 = 10!.
%e A228311 The sum of the digits of 182624820! is 6227020800 = 13!.
%t A228311 lst = {0}; k = p = 1; fctl = Range@ 15!; While[k < 180000, p = p*k; While[ Mod[p, 10] == 0, p /= 10]; If[ MemberQ[ fctl, Plus @@ IntegerDigits@ p], Print[k]; AppendTo[lst, k]]; k++]; lst (* _Robert G. Wilson v_, Feb 18 2014 *)
%t A228311 With[{fcts=Range[20]!},Select[Range[0,22000],MemberQ[fcts,Total[IntegerDigits[#!]]]&]] (* _Harvey P. Dale_, Jan 06 2024 *)
%o A228311 (PARI) lpf(n)=my(f=factor(n)[,1]); f[1]
%o A228311 factorial_lval(n, p)={
%o A228311     my(s);
%o A228311     while(n\=p, s+=n);
%o A228311     s
%o A228311 };
%o A228311 isfactorial(n)={
%o A228311     if(n<3, return(n>0));
%o A228311     my(v2=valuation(n,2),mn=v2+1,mx=mn+log(v2+1.5)\log(2),t,c);
%o A228311     while (mx - mn > 1,
%o A228311         t = mn + (mx - mn)\2;
%o A228311         c = factorial_lval(t, 2);
%o A228311         if (c < v2,
%o A228311             mn = t+1
%o A228311         ,
%o A228311             if (c > v2,
%o A228311                 mx = t-1
%o A228311             ,
%o A228311                 mx = bitor(t,1);
%o A228311                 mn = max(mn, mx-1)
%o A228311             )
%o A228311         )
%o A228311     );
%o A228311     if (mn < mx,
%o A228311         my(p=lpf(mx));
%o A228311         t = valuation(n, p);
%o A228311         c = factorial_lval(mx, p);
%o A228311         if (t > c,return(0));
%o A228311         if (t == c,
%o A228311             mn = mx
%o A228311         )
%o A228311     );
%o A228311     n==mn!
%o A228311 };
%o A228311 is(n)=isfactorial(sumdigits(n!))
%Y A228311 Cf. A229024, A004152.
%K A228311 nonn,base,hard,nice,more
%O A228311 1,3
%A A228311 _Charles R Greathouse IV_, Aug 27 2013
%E A228311 a(8) from _Hans Havermann_, Mar 24 2014