Skip to content

Commit

Permalink
algo(math): fix for loop break statement with <=
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusvrs committed May 26, 2024
1 parent 3f783df commit 1237b2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion algorithms/math/is-prime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bool isprime(ll n) {
if (n < 2) return false;
if (n == 2) return true;
if (n % 2 == 0) return false;
for (ll i = 3; i * i < n; i += 2)
for (ll i = 3; i * i <= n; i += 2)
if (n % i == 0) return false;
return true;
}

0 comments on commit 1237b2a

Please sign in to comment.