File tree 2 files changed +3
-1
lines changed
src/algorithms/math/primality-tests
2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ export default function primalityTest(testFunction) {
16
16
expect ( testFunction ( 4 ) ) . toBeFalsy ( ) ;
17
17
expect ( testFunction ( 6 ) ) . toBeFalsy ( ) ;
18
18
expect ( testFunction ( 12 ) ) . toBeFalsy ( ) ;
19
+ expect ( testFunction ( 14 ) ) . toBeFalsy ( ) ;
20
+ expect ( testFunction ( 25 ) ) . toBeFalsy ( ) ;
19
21
expect ( testFunction ( 192 ) ) . toBeFalsy ( ) ;
20
22
expect ( testFunction ( 200 ) ) . toBeFalsy ( ) ;
21
23
expect ( testFunction ( 400 ) ) . toBeFalsy ( ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default function trialDivision(number) {
18
18
19
19
// If there is no dividers up to square root of n then there is no higher dividers as well.
20
20
const dividerLimit = Math . sqrt ( number ) ;
21
- for ( let divider = 3 ; divider < dividerLimit ; divider += 2 ) {
21
+ for ( let divider = 3 ; divider <= dividerLimit ; divider += 2 ) {
22
22
if ( number % divider === 0 ) {
23
23
return false ;
24
24
}
You can’t perform that action at this time.
0 commit comments