New branch

pull/803/head
WORLDSAVER 2022-08-16 07:49:07 +05:30
parent 09ec4721ba
commit 7626447a82
2 changed files with 0 additions and 22 deletions

View File

@ -85,5 +85,3 @@
- [First in First out Queue](queues/fifo-queue.py)
##Number Theory
- [Prime Number Checker][number_theory/prime_number.py]

View File

@ -1,20 +0,0 @@
#TO CHECK WHETHER A NUMBER IS PRIME OR NOT
def isPrime(N):
for i in range(2, int(N**0.5) + 1):
if N%i==0:
return False
return True
# TIME COMPLEXITY - O(sqrt(N))
# EXAMPLES
# print(isPrime(3)) -> True
# print(isPrime(15)) -> False
# We are just checking till sqrt(N) as if their is any factor of a number
# greater than sqrt(N) then it's partner will be less than sqrt(N) as if a*b>N
# and a>=sqrt(N) then b<=sqrt(N) as if b>sqrt(N) then a*b>N.