login
a(n)-th factorial is the smallest factorial containing exactly n 5's, or 0 if no such number exists.
8

%I #11 Dec 16 2018 14:25:51

%S 7,17,25,30,37,41,43,46,75,65,55,83,74,80,94,116,91,114,131,111,115,

%T 136,147,125,128,143,102,169,152,157,197,150,165,185,193,190,206,198,

%U 192,214,236,203,242,226,205,256,251,220,270,239,230,261,286,222,264

%N a(n)-th factorial is the smallest factorial containing exactly n 5's, or 0 if no such number exists.

%e a(2)=17 since 17th factorial, i.e., 17!=355687428096000 contains exactly two 5's.

%t Do[k = 1; While[ Count[IntegerDigits[k! ], 5] != n, k++ ]; Print[k], {n, 1, 60}]

%t With[{fs=Table[{n,n!},{n,500}]},Table[SelectFirst[fs,DigitCount[#[[2]],10,5] == k&],{k,100}]][[All,1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Dec 16 2018 *)

%Y Cf. A072242, A072220, A072208, A072204, A072200, A072178, A072177, A072163 & A072124.

%K base,nonn

%O 1,1

%A _Shyam Sunder Gupta_, Jul 30 2002

%E Edited and extended by _Robert G. Wilson v_, Jul 31 2002