Browse Source

haskell 001

master
Evan Hemsley 6 months ago
parent
commit
46b96327d5
2 changed files with 11 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +8
    -0
      haskell/euler001.hs

+ 3
- 0
.gitignore View File

@ -4,3 +4,6 @@ c/binaries
*/bin/*
*.dwarf
rust/target
*.hi
*.o

+ 8
- 0
haskell/euler001.hs View File

@ -0,0 +1,8 @@
module Main where
up_to x = take (x-1) (iterate (1+) 1)
divisible_by_3_or_5 x = (x `mod` 3 == 0) || (x `mod` 5 == 0)
main = do
print (sum (filter divisible_by_3_or_5 (up_to 1000)))

Loading…
Cancel
Save