racket solution for problem 5
This commit is contained in:
parent
88e45dc7a3
commit
7ae79991f5
1 changed files with 12 additions and 0 deletions
12
5/euler5.rkt
Normal file
12
5/euler5.rkt
Normal file
|
@ -0,0 +1,12 @@
|
|||
#lang racket
|
||||
|
||||
|
||||
(define (divisible-by? num lst)
|
||||
(andmap (λ (x) (zero? (remainder num x))) lst))
|
||||
|
||||
(define (find-divisible-num it lst)
|
||||
(if (divisible-by? it lst)
|
||||
it
|
||||
(find-divisible-num (+ 2 it) lst)))
|
||||
|
||||
(find-divisible-num 2 (range 1 21))
|
Reference in a new issue