added some solutions in racket, deuglyfied 14
This commit is contained in:
parent
5f58ca8c87
commit
a6770f6bca
4 changed files with 41 additions and 16 deletions
16
30/euler30.rkt
Normal file
16
30/euler30.rkt
Normal file
|
@ -0,0 +1,16 @@
|
|||
#lang racket
|
||||
|
||||
|
||||
(define (findlimit it)
|
||||
(if (> (expt 10 it) (* it (expt 9 5)))
|
||||
it
|
||||
(findlimit (+ it 1))))
|
||||
|
||||
(define (digits x)
|
||||
(map (λ (x) (- (char->integer x) 48))
|
||||
(string->list (number->string x))))
|
||||
|
||||
(apply +(filter (λ (x) (equal? x
|
||||
(apply + (map (λ (x) (expt x 5)) (digits x)))))
|
||||
|
||||
(range 2 (expt 10 (findlimit 1)))))
|
Reference in a new issue