Skip to content

Commit 391b948

Browse files
committed
Added a new Algorithm to check if a number is prime or not.
Added a new Algorithm to check if a number is prime or not. It takes one + half the amount of iterations of the square root of the number. Returns Boolean value.
1 parent 116ab0f commit 391b948

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Maths/PrimeCheck.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def primeCheck(number):
2+
prime = True
3+
for i in range(2, int(number**(1/2)+1), 2):
4+
if number % i == 0:
5+
prime = False
6+
break
7+
return prime
8+
9+
def main():
10+
print(primeCheck(37))
11+
print(primeCheck(100))
12+
13+
if __name__ == '__main__':
14+
main()

0 commit comments

Comments
 (0)