14 lines
380 B
Haskell
14 lines
380 B
Haskell
module Lib (fib, primeFactors) where
|
|
|
|
fib :: [Integer]
|
|
fib = 1 : 2 : zipWith (+) fib (tail fib)
|
|
|
|
primeFactors :: Integer -> [Integer]
|
|
primeFactors n = genPrimeFactors n 2
|
|
where
|
|
genPrimeFactors :: Integer -> Integer -> [Integer]
|
|
genPrimeFactors n c
|
|
| c == n = [n]
|
|
| mod n c /= 0 = genPrimeFactors n (c + 1)
|
|
| otherwise = c : genPrimeFactors (div n c) c
|