Skip to content

Commit b752004

Browse files
committed
Solve 1-2
0 parents  commit b752004

File tree

190 files changed

+9360
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+9360
-0
lines changed

001.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; Problem 1: Multiples of 3 and 5
2+
; If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
3+
4+
; Find the sum of all the multiples of 3 or 5 below 1000.
5+
6+
(apply + (filter #(some zero? (list (mod % 3) (mod % 5))) (range 1000))) ; => 233168

002.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; Problem 2: Even Fibonacci numbers
2+
; Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
3+
4+
; 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
5+
6+
; By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
7+
8+
9+
(apply +
10+
(filter even?
11+
(take-while #(<= % 4000000)
12+
(map first (iterate (fn [[x y]] [y (+ x y)]) [1 2]))))) ; 4613732

003.clj

Whitespace-only changes.

problems.html

Lines changed: 8847 additions & 0 deletions
Large diffs are not rendered by default.

problems_files/MathJax.js

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

problems_files/blackdot.gif

35 Bytes

problems_files/bracket_left.gif

204 Bytes

problems_files/bracket_right.gif

203 Bytes

problems_files/icon_rss.png

1.2 KB

problems_files/icon_unlock.png

905 Bytes

0 commit comments

Comments
 (0)