aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2021-04-19 09:40:40 -0500
committerGitHub2021-04-19 09:40:40 -0500
commit59698d61ab48784d33798a7c8a32daee17940380 (patch)
treeb5ceb092f0eef741141d6b0097770def9799a373
parent8baf3ceec51bb0f9dc52c8a2224698367c84f1e1 (diff)
Create 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)