李营长 发表于 2013-03-07 16:14

求最大素因子,速度太慢了

本帖最后由 李营长 于 2013-03-07 17:16 编辑



isPrime :: Integer->Bool
isPrime x = null , x `mod` y == 0]

problem3 =
      [ x | x <- 2:, n `mod` x == 0, isPrime x]
      where n = 600851475143


haskell没有 100%占用cpu,算起来特别慢:D

yulihua49 发表于 2014-11-30 19:47

李营长 发表于 2013-03-07 16:14 static/image/common/back.gif
isPrime :: Integer->Bool
isPrime x = null
从高到低,用fema小定理
页: [1]
查看完整版本: 求最大素因子,速度太慢了