Skip to content

Instantly share code, notes, and snippets.

View jeffagit-anto's full-sized avatar

jeffagit-anto

View GitHub Profile
primes :: [Int]
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
pr :: [Int] -> [Int]
-- if 2 elements n & m :
pr (n:m:tail) = n*m : pr (m:tail)
-- 1. calculate their product --^ ^-- 2. continue with shifted list 'm:tail'