login
A072220
a(n)-th factorial is the smallest factorial containing exactly n 9's, or 0 if no such number exists.
9
12, 11, 21, 29, 34, 46, 36, 59, 79, 75, 0, 70, 82, 90, 95, 97, 112, 89, 105, 96, 134, 130, 127, 165, 142, 149, 144, 145, 161, 163, 182, 189, 160, 178, 139, 180, 206, 192, 224, 214, 188, 215, 226, 207, 218, 267, 283, 261, 268, 262, 240, 280, 234, 285, 343, 277, 284, 269, 281, 331, 278, 308
OFFSET
1,1
COMMENTS
It is conjectured that a(11) = 0 since no factorial < 10000 contains exactly eleven nines.
LINKS
Robert Israel, Table of n, a(n) for n = 1 .. 1000 (entries of 0 are conjectured)
EXAMPLE
a(2) = 11 since 11! = 39916800 contains exactly two 9's.
MAPLE
f:= n -> numboccur(9, convert(n, base, 10)):
V:= Vector(100):
q:= 1:
for i from 2 to 2000 do
q:= i*q; v:= f(q);
if v > 0 and v < 100 and V[v] = 0 then V[v]:= i; fi
od:
convert(V, list); # Robert Israel, Sep 29 2024
MATHEMATICA
Do[k = 1; While[ Count[IntegerDigits[k! ], 9] != n, k++ ]; Print[k], {n, 1, 60}]
Module[{c=Table[{n, DigitCount[n!, 10, 9]}, {n, 350}]}, Table[SelectFirst[c, #[[2]]==m&], {m, 60}]][[;; , 1]]/."NotFound"->0 (* Harvey P. Dale, Sep 18 2023 *)
PROG
(Python)
def a(n, multiple_limit=300):
fk, limit = 1, multiple_limit*n
for k in range(1, limit+1):
fk *= k
if str(fk).count("9") == n: return k
return 0
print([a(n) for n in range(1, 57)]) # Michael S. Branicky, Dec 11 2021
KEYWORD
base,nonn
AUTHOR
Shyam Sunder Gupta, Jul 30 2002
EXTENSIONS
Edited and extended by Robert G. Wilson v, Jul 31 2002
More terms from Robert Israel, Sep 29 2024
STATUS
approved