At last count I did that exercise in 11 different languages, so maybe I'll post some of the less common ones.

Clojure:

(defn problem1 [n] (reduce + (filter #(or (= 0 (mod % 3)) (= 0 (mod % 5))) (range 1 n)))) (println (problem1 1000))

Haskell (boring):

main :: IO () main = print problem1 problem1 :: Integer problem1 = sum (filter (\x -> x `mod` 3 == 0 || x `mod` 5 == 0) [1..999])

Haskell (a bit more interesting, but wasteful):

import Data.List problem1 = sum $ nub $ [3,6..999] ++ [5,10..999]

Potion:

Number dividesBy = (x): self % x == 0. sum = 0 1 to 999 (x): if (x dividesBy(3) || x dividesBy(5)): sum += x _x (sum, "\n") join print

GNU Smalltalk:

res := ((3 to: 999) select: [:i| (i \\ 3 = 0) | (i \\ 5 = 0)]) inject: 0 into: [:sum :i| sum+i]. res printNl

Here's one in Haskell using list comprehension:

sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0]

We're a place where coders share, stay up-to-date and grow their careers.

We strive for transparency and don't collect excess data.

## re: Project Euler #1 - Multiples of 3 and 5 VIEW POST

FULL DISCUSSIONAt last count I did that exercise in 11 different languages, so maybe I'll post some of the less common ones.

Clojure:

Haskell (boring):

Haskell (a bit more interesting, but wasteful):

Potion:

GNU Smalltalk:

Here's one in Haskell using list comprehension: