racket solutions for problems 6 7 and 8

This commit is contained in:
Lowl3v3l 2017-05-09 20:57:45 +02:00
parent 14379b035f
commit 04a8190ccb
3 changed files with 57 additions and 0 deletions

12
7/euler7.rkt Normal file
View file

@ -0,0 +1,12 @@
#lang racket
(require math/number-theory)
(define (nth-prime it n primes)
(if (equal? n (length primes))
(car primes)
(if (prime? it)
(nth-prime (+ it 2) n (cons it primes))
(nth-prime (+ it 2) n primes))))
(nth-prime 3 10001 (list 2))