(define (full-fermat-test n)
(define (iter a)
(cond ((= a 1) #t)
((= (expmod a n n ) a) (iter (- a 1)))
(else #f)))
(iter (- n 1)))
> (full-fermat-test 561)
#t
/> (full-fermat-test 1105)
#t
/> (full-fermat-test 1729)
#t
/> (full-fermat-test 2465)
#t
/> (full-fermat-test 2821)
#t
/> (full-fermat-test 6601)
#t

댓글 없음:
댓글 쓰기