0
嗯......當爲任何大於3的整數求值時,爲什麼函數以無限循環結束?遞歸Haskell函數中的無限循環
smallestMultiple n = factors [2..n] where
factors [] = []
factors (h:xs) = h:(factors $ filter ((<)1) [div x h|x<-xs])
where
div x y
|x `mod` y ==0 = x `div` y
|otherwise = x
哦....這很有道理。謝謝 – Julio 2015-02-09 20:32:30