EvgenyKarkan/EKAlgorithms

Incorrect isPrime Method

ahanmal opened this issue · 1 comments

for (int i = 2; i <= (int)sqrt(givenNumber); i++) {
         if (givenNumber % i == 0) {
           return YES;
         }
     }

should be:

for (int i = 2; i <= (int)sqrt(givenNumber); i++) {
         if (givenNumber % i == 0) {
           return NO;
         }
     }

I'll open a PR soon.

Merged.