Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean isPrime(int n)
- {
- if (n == 2 || n == 3)
- return true;
- if (n%2 == 0 || n%3 == 0)
- return false;
- int i = 5;
- int w = 2;
- while (i * i <= n)
- {
- if (n % i == 0)
- return false;
- i += w;
- w = 6 - w;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement