Problem 6
Ruby
1sum_squares = 0
2count = 0
3square_sum = 0
4loop do
5 if count == 101
6 break
7 end
8 sum_squares += (count ** 2)
9 square_sum += count
10 count += 1
11end
12puts"#{(square_sum ** 2) - sum_squares}"
Clojure
1(ns problem6.core)
2
3(defn -main
4 []
5 (println (- (int (Math/pow (reduce + (range 1 101)) 2)) (int (reduce + (map #(Math/pow % 2) (range 1 101)))))))
Perl 6
1say ((1..100).sum ** 2) - ((1..100).map(* ** 2).sum)