Skip to content

Commit 17dbf72

Browse files
committed
added question: IS PRIME?
1 parent ef7360d commit 17dbf72

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Is prime?/problem.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Implement a function that determines if a given positive integer is a prime or not.
2+
3+
Example
4+
5+
For n = 47, the output should be
6+
isPrime(n) = true;
7+
8+
For n = 4, the output should be
9+
isPrime(n) = false;

Is prime?/solution.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
isPrime n = length (filter (==0) (map (mod n) [1..n])) == 2

0 commit comments

Comments
 (0)