标签:highlight as3 最小 sci efi square prim ide divide
(define (smallest-divisor n) (find-divisor n 2)) (define (find-divisor n test-divisor) (cond ((> (square test-divisor) n) n) ((divides? n test-divisor) test-divisor) (else (find-divisor n (+ test-divisor 1))))) (define (divides? a b) (= (remainder a b) 0)) ;(define (prime? n) ; (= n (smallest-divisor n))) (define (square x) (* x x)) (smallest-divisor 199) (smallest-divisor 1999) (smallest-divisor 19999)
199
1999
7
标签:highlight as3 最小 sci efi square prim ide divide
原文地址:http://www.cnblogs.com/R4mble/p/7892348.html