Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (define (prime? p)
- (define (non-divisible-by n d)
- (cond
- ((= d 1) #t)
- (else (if(= (remainder n d) 0)
- #f
- (non-divisible-by n (- d 1))))))
- (if (= p 1)
- #f
- (non-divisible-by p (- p 1))))
- (define (sumprimes a b)
- (if(> a b)
- 0
- (if(prime? a)
- (+ a (sumprimes (+ a 1) b))
- (sumprimes (+ a 1) b))
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement