Created
March 9, 2015 23:38
-
-
Save rinfz/4c62e4fa08fee85e4350 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (is-prime n) | |
(if (<= n 3) | |
(>= n 2) | |
(if (or (= (modulo n 2) 0) (= (modulo n 3) 0)) | |
#f | |
(do ((i 5 (+ i 6))) ((> i (+ (sqrt n) 1))) | |
(if (or (= (modulo n i) 0) (= (modulo n (+ i 2)) 0)) | |
#f))) #t)) | |
(define (main args) | |
(display (is-prime 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment