"Richard O'Keefe" <o...@cs.otago.ac.nz> writes:

> factors n = [m | m <- [1..n], mod n m == 0]

  -- saves about 10% time, seems to give the same result:
  factors n = [m | m <- [1..n `div` 2], mod n m == 0]++[n]

(But checking against primes is even faster, it seems)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to