Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (isprimeimpl x y)
- (or (= y 0)
- (and (not (= (mod x (+ y 1)) 0)) (isprimeimpl x (- y 1)))
- )
- )
- (define (isprime x)
- (isprimeimpl x (- x 2))
- )
- (define (test x)
- (or (and x 1) 0))
- (define (sumOfPrimeDivsImpl y c)
- (if (= c 1)
- 0
- (+
- (* (* (- y c) (test (isprime (- y c)))) (test (= (mod y (- y c)) 0)))
- (sumOfPrimeDivsImpl y (- c 1))))
- )
- (define (sumOfPrimeDivs y)
- (sumOfPrimeDivsImpl y y)
- )
- (define (R y x)
- (and
- (not (= y 0))
- (< (sumOfPrimeDivs y) x)
- ))
- (R 10 8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement