Skip to content

Commit da21539

Browse files
committed
Fixes exercism#420
nth-prime: simplify example implementation
1 parent 6e0c6a6 commit da21539

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎exercises/nth-prime/src/example/java/PrimeCalculator.java‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ private boolean isPrime(int n) {
3333
.rangeClosed(2, (int) Math.ceil(Math.sqrt(n)))
3434
.anyMatch((int i) -> n % i == 0);
3535

36-
if (divisible) {
37-
return false;
38-
}
39-
40-
return true;
36+
return !divisible;
4137
}
4238
}

0 commit comments

Comments
 (0)