|
![](/i/fill.gif) |
Neeum Zawan <m.n### [at] ieee org> wrote:
> On 09/22/09 15:44, clipka wrote:
> > Thus, the number of trailing zeros can be expressed as:
> >
> > floor(n/5) + floor (n/(5^2)) + floor(n/(5^3)) + ...
> >
> > which is a perfectly valid, non-recursive (albeit infinite) mathematical
> > formula for the desired thing. (Unfortunately the floor() function
> While he didn't state it in his original phrasing, he meant closed form.
If we allow recursive functions, then the simplest answer would be:
f(0) = 0
f(n) = floor(n/5) + f(floor(n/5))
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |