This repository has been archived on 2024-01-26. You can view files and clone it, but cannot push or open issues or pull requests.
project-euler/7/euler7.rkt
2017-05-09 20:57:45 +02:00

12 lines
No EOL
272 B
Racket

#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))