[Haskell-cafe] Style

Marc A. Ziegert coeus at gmx.de
Fri Aug 24 05:14:07 EDT 2007


"Marc A. Ziegert" <coeus at gmx.de>

> tm_parallelizable_v1 = \n -> sum . takeWhile (>0) $ map (div n) fives
> 	where fives = iterate (*5) 1
> tm_improved_v1 n = sum . takeWhile (>0) $ iterate (div `flip` 5) (div n 5)
> tm_fastestIMHO n = let m=div n 5 in if m<5 then m else m+tm_fastestIMHO m


Henning Thielemann <lemming at henning-thielemann.de>

> tm4 = sum . takeWhile(>0) . tail . iterate (flip div 5)


Bjorn Bringert <bringert at cs.chalmers.se>

> tm_silly n = length $ takeWhile (=='0') $ reverse $ show $ product [1..n]
 

Arie Groeneveld <bradypus at xs4all.nl>

> tm = sum . takeWhile(>0) . iterate f . f
>    where f = flip div 5
> tm1 n = sum . takeWhile(>0) . map (div n . (5^)) $ [1..]
> tm2 n = sum . takeWhile(>0) . map (div n) $ iterate ((*)5) 5
> tm3 = sum . takeWhile(>0) . flip map (iterate ((*)5) 5) . div
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070824/39229c6e/attachment.bin


More information about the Haskell-Cafe mailing list