aboutsummaryrefslogtreecommitdiff
path: root/test.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test.hs')
-rw-r--r--test.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/test.hs b/test.hs
new file mode 100644
index 0000000..c202f35
--- /dev/null
+++ b/test.hs
@@ -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)