Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (pairgcd lst)
- (define (searching lest rez)
- (if (= (length lest) 2) (+ (gcd (car lest) (cadr lest)) rez)
- (searching (cdr lest) (+ (gcd (car lest) (cadr lest)) rez))))
- (searching lst 0))
- (define (Sol1 lst)
- (define newlst (permutations lst))
- (define (searching lest maxi)
- (if (empty? (cdr lest)) (if (< (pairgcd maxi) (pairgcd (car lest))) (car lest) maxi)
- (if (<= (pairgcd (car lest)) (pairgcd maxi)) (searching (cdr lest) maxi)
- (searching (cdr lest) (car lest)))))
- (searching newlst (car newlst)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement