-- Exercice from slide 42 dividers n = [k | k <- takeWhile (\k -> k * k <= n) primeinf, rem n k == 0] dividersf n = filter (\k -> rem n k == 0) [2..(n-1)] primer n = [i | i <- [2..(n-1)], null (dividers i)] primerf n = filter (\i -> null (dividersf i)) [2..(n-1)] square n = n * n -- Exercice from slide 50 primeinf = 2:[i | i <- [3..], null (dividers i)]