10061

[highlight]Solution[/highlight]

/*
Now we can break the Base B as a product of primes :
B = a^p1 * b^p2 * c^p3 * …
Then the number of trailing zeroes in N factorial in Base B is given by the formulae
min{1/p1(n/a + n/(a*a) + ….), 1/p2(n/b + n/(b*b) + ..), ….}.

And the number of digits in N factorial is :
floor (ln(n!)/ln(B) + 1)

*/

 

Leave a Reply

Your email address will not be published. Required fields are marked *