5 lines
174 B
Haskell
5 lines
174 B
Haskell
|
factor n divisor
|
||
|
| (divisor == n-1 || n == 1) = [n]
|
||
|
| rem n divisor == 0 = (factor (fromIntegral n/divisor) 2) ++ (factor divisor 2)
|
||
|
| otherwise = factor n (divisor+1)
|