summaryrefslogtreecommitdiff
path: root/prime/prime.scm
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2024-08-04 21:01:32 -0600
committerbd <bdunahu@operationnull.com>2024-08-04 21:01:32 -0600
commit3324327b80a50e94843dedbb704683ee9b3a9955 (patch)
tree333f24d8de37c480a101f100a5ca539cc34552fe /prime/prime.scm
parentc04ceb5f29e965bb2d9b37bf38f10f7a12a0cab0 (diff)
Cleanup prime?
Diffstat (limited to 'prime/prime.scm')
-rwxr-xr-xprime/prime.scm17
1 files changed, 0 insertions, 17 deletions
diff --git a/prime/prime.scm b/prime/prime.scm
deleted file mode 100755
index 89915a1..0000000
--- a/prime/prime.scm
+++ /dev/null
@@ -1,17 +0,0 @@
-(define-module (prime))
-
-
-(define-public (prime? n)
- "Returns #t if N is prime, else #f."
- (if (< n 2)
- #f
- (prime-helper n (quotient n 2))))
-
-(define (prime-helper n d)
- "Recursively checks if N is a prime number
-by attempting division by number D,D-1,D-2..."
- (if (< d 2)
- #t
- (if (equal? (remainder n d) 0)
- #f
- (prime-helper n (1- d)))))