From 5f58ca8c87bea712367fc2a9e3fb37780d78b81a Mon Sep 17 00:00:00 2001 From: Lowl3v3l Date: Tue, 9 May 2017 21:53:02 +0200 Subject: [PATCH] solution for problem 9 in racket --- 9/euler9.rkt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 9/euler9.rkt diff --git a/9/euler9.rkt b/9/euler9.rkt new file mode 100644 index 0000000..738e763 --- /dev/null +++ b/9/euler9.rkt @@ -0,0 +1,14 @@ +#lang racket + + +(define squarenums (map (λ (x) (* x x)) (range 1 500))) + +(define squaresums + (for/list ((i squarenums)) + (for/list ((j (cdr squarenums))) + (list (+ i j) i j)))) + +(apply * (map sqrt + (first (filter + (λ (x) (equal? 1000 (+ (sqrt (first x)) (sqrt (second x)) (sqrt (third x))))) + (filter (λ (x) (member (first x) squarenums)) (apply append squaresums)))))) \ No newline at end of file