Create test.hs

This commit is contained in:
Anthony Wang 2021-04-19 09:40:40 -05:00 committed by GitHub
parent 8baf3ceec5
commit 59698d61ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

10
test.hs Normal file
View file

@ -0,0 +1,10 @@
-- Haskell
gcd :: Integer -> Integer -> Integer
gcd a b = if b > 0 then gcd b (mod a b) else a
main = do
putStrLn "test"
let n = 1000
let a = [0..n-1]
print $ foldl (+) 0 (map (\i -> foldl (+) 0 (map (`gcd` i) a)) a)