deuglyfied racket solution for problem 1
This commit is contained in:
parent
3872593d2f
commit
eae9b67bac
1 changed files with 6 additions and 9 deletions
15
1/euler1.rkt
15
1/euler1.rkt
|
@ -1,10 +1,7 @@
|
||||||
#lang racket
|
#lang typed/racket
|
||||||
|
|
||||||
(define (multiples limit)
|
(foldl (λ ((x : Nonnegative-Integer)
|
||||||
(foldl + 0 (filter (lambda (x) (cond
|
(y : Nonnegative-Integer))
|
||||||
[(= 0 (remainder x 3)) #t]
|
(if (or (zero? (remainder x 3))
|
||||||
[(= 0 (remainder x 5)) #t]
|
(zero? (remainder x 5)))
|
||||||
(else #f)))
|
(+ x y) y)) 0 (range 1 1000))
|
||||||
(range limit))))
|
|
||||||
|
|
||||||
(multiples 1000)
|
|
Reference in a new issue