You are viewing a single comment's thread. Return to all comments →
When i execute is_prime() with n = 4 it is returning true. It should not be right?
IntStream.range(2, (int) (Math.sqrt(n) + 1)) .noneMatch(i -> n%i == 0);
This code would fix the issue i think.
Seems like cookies are disabled on this browser, please enable them to open this website
Java Lambda Expressions
You are viewing a single comment's thread. Return to all comments →
When i execute is_prime() with n = 4 it is returning true. It should not be right?
This code would fix the issue i think.