diff --git a/1/euler1.rkt b/1/euler1.rkt new file mode 100644 index 0000000..8b116df --- /dev/null +++ b/1/euler1.rkt @@ -0,0 +1,10 @@ +#lang racket + +(define (multiples limit) + (foldl + 0 (filter (lambda (x) (cond + [(= 0 (remainder x 3)) #t] + [(= 0 (remainder x 5)) #t] + (else #f))) + (range limit)))) + +(multiples 1000) \ No newline at end of file diff --git a/2/euler2.rkt b/2/euler2.rkt new file mode 100644 index 0000000..2fc3525 --- /dev/null +++ b/2/euler2.rkt @@ -0,0 +1,13 @@ +#lang racket + +(define (fib i) + (cond [(equal? 0 i) 1] + [(equal? 1 i) 2] + (else (+ (fib (- i 1))(fib (- i 2)))))) + +(define (fiblist it limit lst) + (cond [(equal? limit it) lst] + (else (fiblist (+ it 1) limit + (cons (fib it) lst))))) + +(foldl + 0 (filter even? (fiblist 0 4000000 '()))) \ No newline at end of file