Created
September 21, 2019 16:22
-
-
Save even4void/b839d4b99d53a7fd9d6b84681efb7e0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
;; Euler problem 15 | |
(define (reduce f xs) | |
(and (not (empty? xs)) (foldl f (first xs) (rest xs)))) | |
(define (f n) | |
(reduce (lambda (x y) (* x y)) (range 1 (add1 n)))) | |
(define (sol-015 [n 20]) | |
(ceiling (/ (f (* n 2)) (f n) (f n)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment