Added test for isPrime function

This commit is contained in:
2021-07-01 10:06:13 -04:00
parent 28e28c2ee4
commit bb5b8154ae
2 changed files with 49 additions and 2 deletions

View File

@@ -327,7 +327,7 @@ export function isPrime(possiblePrime: number): boolean{
else if(((possiblePrime % 2) == 0) || ((possiblePrime % 3) == 0)){
return false;
}
for(let cnt: number = 5;(cnt * cnt) <= possiblePrime; cnt += 6){
for(let cnt: number = 5;(cnt * cnt) <= possiblePrime;cnt += 6){
if(((possiblePrime % cnt) == 0) || ((possiblePrime % (cnt + 2)) == 0)){
return false;
}