Skip to content

Instantly share code, notes, and snippets.

Avatar

jeffagit-anto

View GitHub Profile
View greeting2021.hs
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'