I have a basic understanding of how to calculate Time Complexities, but I'm not sure how to calculate it in this case due to the random nature of primes.
A quick explanation --> Essentially, I'm keeping a running count of the remainders so that I know when the next prime is.
My code:
import math
n = int(input("Enter the number:\t"))
primeList = []
checkList = []
number = 3
isPrime = True
while number <= math.sqrt(n) and isPrime:
isChanged = False
for i, checkNum in enumerate(checkList):
if checkNum == 1:
isChanged = True
checkList[i] = primeList[i]
else:
checkList[i] = checkNum - 1
if not isChanged:
primeList.append(number)
checkList.append(number)
if n % number == 0:
isPrime = False
number += 2
if isPrime:
print("Prime")
else:
print("Not Prime")