[Haskell-cafe] Zumkeller numbers
Henning Thielemann
lemming at henning-thielemann.de
Mon Dec 7 19:07:30 EST 2009
On Tue, 8 Dec 2009, Richard O'Keefe wrote:
> is_Zumkeller :: Int -> Bool
> is_Zumkeller n =
> let facs = factors n
> fsum = sum facs
> in mod fsum 2 == 0 &&
I see this test is essential. I didn't do it and thus my program did not
find that 1800 is not a Zumkeller number within an hour. With this check
my program becomes dramatically faster.
> can_part facs (div fsum 2)
>
> main = print (filter is_Zumkeller [1..5000])
More information about the Haskell-Cafe
mailing list