File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
src/algorithms/math/primality-tests Expand file tree Collapse file tree 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) {
1616 expect ( testFunction ( 4 ) ) . toBeFalsy ( ) ;
1717 expect ( testFunction ( 6 ) ) . toBeFalsy ( ) ;
1818 expect ( testFunction ( 12 ) ) . toBeFalsy ( ) ;
19+ expect ( testFunction ( 14 ) ) . toBeFalsy ( ) ;
20+ expect ( testFunction ( 25 ) ) . toBeFalsy ( ) ;
1921 expect ( testFunction ( 192 ) ) . toBeFalsy ( ) ;
2022 expect ( testFunction ( 200 ) ) . toBeFalsy ( ) ;
2123 expect ( testFunction ( 400 ) ) . toBeFalsy ( ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default function trialDivision(number) {
1818
1919 // If there is no dividers up to square root of n then there is no higher dividers as well.
2020 const dividerLimit = Math . sqrt ( number ) ;
21- for ( let divider = 3 ; divider < dividerLimit ; divider += 2 ) {
21+ for ( let divider = 3 ; divider <= dividerLimit ; divider += 2 ) {
2222 if ( number % divider === 0 ) {
2323 return false ;
2424 }
You can’t perform that action at this time.
0 commit comments