Starting Euler 1: done python, ruby and lisp, working on erlang

This commit is contained in:
Dan Ballard 2011-03-27 10:31:47 -07:00
commit f2cd84cffc
4 changed files with 28 additions and 0 deletions

4
e1.erl Normal file
View File

@ -0,0 +1,4 @@
-module(e1).
-export([e1/1]).
e1(

5
e1.lisp Normal file
View File

@ -0,0 +1,5 @@
(let ((sum 0))
(loop for i from 2 to 999 do
(if (or (eql (mod i 3) 0) (eql (mod i 5) 0))
(incf sum i)))
(format t "~d~%" sum))

8
e1.py Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python
sum = 0
for i in range(2,1000):
if i % 3 == 0 or i % 5 ==0 :
sum += i
print sum

11
e1.rb Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/ruby
sum = 0
for i in 2..999
if i % 3 == 0 or i % 5 == 0
sum += i
end
end
print sum.to_s + "\n"