Skip to content

Commit e99c722

Browse files
👌 IMPROVE: Modified the code
1 parent e9b5a6a commit e99c722

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Project-Euler/Problem007.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export const nthPrime = (n) => {
1616
}
1717

1818
let count = 0
19-
let candidateValue = 2
19+
let candidateValue = 1
2020
while (count < n) {
21+
candidateValue++
2122
if (PrimeCheck(candidateValue)) {
2223
count++
2324
}
24-
candidateValue++
2525
}
26-
return candidateValue - 1
26+
return candidateValue
2727
}

0 commit comments

Comments
 (0)