Update
This commit is contained in:
parent
124b9d1e7c
commit
3f374a4713
85 changed files with 2281 additions and 2272 deletions
10
prime.md
10
prime.md
|
@ -105,20 +105,20 @@ int isPrime(int n)
|
|||
{
|
||||
if (n < 4)
|
||||
return n > 1;
|
||||
|
||||
|
||||
if (n % 2 == 0 || n % 3 == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
int test = 6;
|
||||
|
||||
|
||||
while (test <= n / 2) // replace n / 2 by sqrt(n) if available
|
||||
{
|
||||
if (n % (test + 1) == 0 || n % (test - 1) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
test += 6;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue