aboutsummaryrefslogtreecommitdiff
path: root/test.hs
blob: 02ff5886fdd0224441494e1e0d2c1fdd2d023e40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
-- Haskell

import Prelude hiding (gcd)

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)