Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (bestnod num lstnum)
- (filter ( λ(a)(< 1 (gcd num a) )) lstnum))
- (define (Maxnod n lst)
- (define (maxnod n lst)
- (define newnod (bestnod n lst))
- (if (empty? newnod) (cons 1 (list n))
- (let ( (nowres (foldl (λ (newnum newpair)
- (define x (maxnod newnum (remove newnum lst)))
- (if (> (car x) (car newpair)) x newpair)) (cons 0 '()) newnod)))
- (cons (+ 1 (car nowres)) (cons n (cdr nowres))))))
- (cdr (maxnod n lst)))
- (define (Mygraph graph)
- (define (fun n)
- (if (= n (length graph))
- null
- (cons (foldl (lambda (x rez)
- (if (member n x)
- (cons (index-of graph x) rez)
- rez)) null graph) (fun (+ 1 n)))))
- (fun 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement