Skip to content

Commit 321e7bb

Browse files
committed
more difficult test numbers for Hart and Lehman algorithms
1 parent 2ad24f0 commit 321e7bb

12 files changed

+98
-14
lines changed

src/test/java/de/tilman_neumann/jml/factor/hart/HartFast2Mult2Test.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
/**
2828
* QA tests for the HartFast2Mult2 factor algorithm.
2929
*
30-
* Although Hart implementations usually need trial division up to cbrt(N),
31-
* this algorithm is capable of factoring many inputs with small prime factors.
32-
* I'm quite sure though that we could still find such numbers needing trial division.
30+
* Usually Hart implementations need trial division up to cbrt(N).
31+
* This is confirmed by the tests although many numbers with small prime factors can be factored completely.
3332
*
3433
* The second interesting point is which size of inputs the algorithm is able to handle.
3534
* With array sizes I_MAX=2^21 the algorithm factors all test numbers here below 60 bit and some above.
@@ -78,6 +77,13 @@ public void testCompositesWithSmallFactors() {
7877
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7978
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
8079
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
80+
assertFullFactorizationFailure(625284020431L, "7 * 89326288633");
81+
assertFullFactorizationFailure(586263075576L, "2^3 * 3 * 24427628149");
82+
assertFullFactorizationFailure(864106952674L, "2 * 7 * 61721925191");
83+
assertFullFactorizationFailure(926922993731L, "7 * 132417570533");
84+
assertFullFactorizationFailure(718370101419L, "3 * 239456700473");
85+
assertFullFactorizationFailure(34108147078032L, "2^4 * 3 * 710586397459");
86+
assertFullFactorizationFailure(906984307049289L, "3 * 7 * 293 * 147405218113");
8187
}
8288

8389
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartFast2MultFMATest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
/**
2828
* QA tests for the HartFast2MultFMA factor algorithm.
2929
*
30-
* Although Hart implementations usually need trial division up to cbrt(N),
31-
* this algorithm is capable of factoring many inputs with small prime factors.
32-
* I'm quite sure though that we could still find such numbers needing trial division.
30+
* Usually Hart implementations need trial division up to cbrt(N).
31+
* This is confirmed by the tests although many numbers with small prime factors can be factored completely.
3332
*
3433
* The second interesting point is which size of inputs the algorithm is able to handle.
3534
* With array sizes I_MAX=2^21 the algorithm factors all test numbers here below 60 bit and some above.
@@ -78,6 +77,13 @@ public void testCompositesWithSmallFactors() {
7877
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7978
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
8079
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
80+
assertFullFactorizationFailure(625284020431L, "7 * 89326288633");
81+
assertFullFactorizationFailure(586263075576L, "2^3 * 3 * 24427628149");
82+
assertFullFactorizationFailure(864106952674L, "2 * 7 * 61721925191");
83+
assertFullFactorizationFailure(926922993731L, "7 * 132417570533");
84+
assertFullFactorizationFailure(718370101419L, "3 * 239456700473");
85+
assertFullFactorizationFailure(34108147078032L, "2^4 * 3 * 710586397459");
86+
assertFullFactorizationFailure(906984307049289L, "3 * 7 * 293 * 147405218113");
8187
}
8288

8389
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartFast2MultTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
/**
2828
* QA tests for the HartFast2Mult factor algorithm.
2929
*
30-
* Although Hart implementations usually need trial division up to cbrt(N),
31-
* this algorithm is capable of factoring many inputs with small prime factors.
32-
* I'm quite sure though that we could still find such numbers needing trial division.
30+
* Usually Hart implementations need trial division up to cbrt(N).
31+
* This is confirmed by the tests although many numbers with small prime factors can be factored completely.
3332
*
3433
* The second interesting point is which size of inputs the algorithm is able to handle.
3534
* With array sizes I_MAX=2^21 the algorithm factors all test numbers here below 60 bit and some above.
@@ -78,6 +77,13 @@ public void testCompositesWithSmallFactors() {
7877
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7978
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
8079
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
80+
assertFullFactorizationFailure(625284020431L, "7 * 89326288633");
81+
assertFullFactorizationFailure(586263075576L, "2^3 * 3 * 24427628149");
82+
assertFullFactorizationFailure(864106952674L, "2 * 7 * 61721925191");
83+
assertFullFactorizationFailure(926922993731L, "7 * 132417570533");
84+
assertFullFactorizationFailure(718370101419L, "3 * 239456700473");
85+
assertFullFactorizationFailure(34108147078032L, "2^4 * 3 * 710586397459");
86+
assertFullFactorizationFailure(906984307049289L, "3 * 7 * 293 * 147405218113");
8187
}
8288

8389
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartFastTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
/**
2828
* QA tests for the HartFast factor algorithm.
2929
*
30-
* The factorization errors in this test point out that in comparison to the HartFast2Mult* variants
31-
* a) HartFast is not as resistant against small factors
32-
* b) it needs bigger sqrt arrays to factor big numbers
30+
* Usually Hart implementations need trial division up to cbrt(N).
31+
* This is confirmed by the tests although many numbers with small prime factors can be factored completely.
32+
*
33+
* Some more test failures in this variant are caused by too small sqrt arrays.
3334
*/
3435
public class HartFastTest extends FactorTestBase {
3536

@@ -74,6 +75,13 @@ public void testCompositesWithSmallFactors() {
7475
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7576
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
7677
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
78+
assertFullFactorizationFailure(625284020431L, "7 * 89326288633");
79+
assertFullFactorizationFailure(586263075576L, "2^3 * 3 * 24427628149");
80+
assertFullFactorizationFailure(864106952674L, "2 * 7 * 61721925191");
81+
assertFullFactorizationFailure(926922993731L, "7 * 132417570533");
82+
assertFullFactorizationFailure(718370101419L, "3 * 239456700473");
83+
assertFullFactorizationFailure(34108147078032L, "2^4 * 3 * 710586397459");
84+
assertFullFactorizationSuccess(906984307049289L, "3 * 7 * 293 * 147405218113"); // interesting
7785
}
7886

7987
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartSimpleTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ public void testCompositesWithSmallFactors() {
7373
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7474
assertFullFactorizationFailure(624800360363L, "233 * 2681546611"); // 40 bit, needs trial division
7575
assertFullFactorizationFailure(883246601513L, "251 * 3518910763"); // 40 bit, needs trial division
76+
assertFullFactorizationFailure(625284020431L, "7 * 89326288633");
77+
assertFullFactorizationFailure(586263075576L, "2^3 * 3 * 24427628149");
78+
assertFullFactorizationFailure(864106952674L, "2 * 7 * 61721925191");
79+
assertFullFactorizationFailure(926922993731L, "7 * 132417570533");
80+
assertFullFactorizationFailure(718370101419L, "3 * 239456700473");
81+
assertFullFactorizationFailure(34108147078032L, "2^4 * 3 * 710586397459");
82+
assertFullFactorizationFailure(906984307049289L, "3 * 7 * 293 * 147405218113");
7683
}
7784

7885
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartSquarefreeTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
/**
2828
* QA tests for the HartSquarefree factor algorithm.
2929
*
30-
* The factorization errors in this test point out that in comparison to the HartFast2Mult* variants
31-
* HartSquarefree is not as resistant against small factors.
30+
* Usually Hart implementations need trial division up to cbrt(N).
31+
* This is confirmed by the tests although many numbers with small prime factors can be factored completely.
3232
*
3333
* On the other hand it is surprisingly good for factoring larger inputs.
3434
*/
@@ -89,6 +89,13 @@ public void testCompositesWithSmallFactors() {
8989
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
9090
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
9191
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
92+
assertFullFactorizationFailure(625284020431L, "7 * 89326288633");
93+
assertFullFactorizationFailure(586263075576L, "2^3 * 3 * 24427628149");
94+
assertFullFactorizationFailure(864106952674L, "2 * 7 * 61721925191");
95+
assertFullFactorizationFailure(926922993731L, "7 * 132417570533");
96+
assertFullFactorizationFailure(718370101419L, "3 * 239456700473");
97+
assertFullFactorizationFailure(34108147078032L, "2^4 * 3 * 710586397459");
98+
assertFullFactorizationSuccess(906984307049289L, "3 * 7 * 293 * 147405218113");
9299
}
93100

94101
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartTDivRace2Test.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* QA tests for the HartTDivRace2 factor algorithm.
2929
*
3030
* The tests show that this implementation is surprisingly stable.
31+
* The few test errors are caussed by too small sqrt arrays.
3132
*/
3233
public class HartTDivRace2Test extends FactorTestBase {
3334

@@ -72,6 +73,13 @@ public void testCompositesWithSmallFactors() {
7273
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7374
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
7475
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
76+
assertFullFactorizationSuccess(625284020431L, "7 * 89326288633");
77+
assertFullFactorizationSuccess(586263075576L, "2^3 * 3 * 24427628149");
78+
assertFullFactorizationSuccess(864106952674L, "2 * 7 * 61721925191");
79+
assertFullFactorizationSuccess(926922993731L, "7 * 132417570533");
80+
assertFullFactorizationSuccess(718370101419L, "3 * 239456700473");
81+
assertFullFactorizationSuccess(34108147078032L, "2^4 * 3 * 710586397459");
82+
assertFullFactorizationSuccess(906984307049289L, "3 * 7 * 293 * 147405218113");
7583
}
7684

7785
@Test

src/test/java/de/tilman_neumann/jml/factor/hart/HartTDivRaceTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* QA tests for the HartTDivRace factor algorithm.
2929
*
3030
* The tests show that this implementation is surprisingly stable.
31+
* The few test errors are caussed by too small sqrt arrays.
3132
*/
3233
public class HartTDivRaceTest extends FactorTestBase {
3334

@@ -72,6 +73,13 @@ public void testCompositesWithSmallFactors() {
7273
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7374
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
7475
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
76+
assertFullFactorizationSuccess(625284020431L, "7 * 89326288633");
77+
assertFullFactorizationSuccess(586263075576L, "2^3 * 3 * 24427628149");
78+
assertFullFactorizationSuccess(864106952674L, "2 * 7 * 61721925191");
79+
assertFullFactorizationSuccess(926922993731L, "7 * 132417570533");
80+
assertFullFactorizationSuccess(718370101419L, "3 * 239456700473");
81+
assertFullFactorizationSuccess(34108147078032L, "2^4 * 3 * 710586397459");
82+
assertFullFactorizationSuccess(906984307049289L, "3 * 7 * 293 * 147405218113");
7583
}
7684

7785
@Test

src/test/java/de/tilman_neumann/jml/factor/lehman/LehmanCustomKOrderTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public void testCompositesWithSmallFactors() {
7070
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7171
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
7272
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
73+
assertFullFactorizationSuccess(625284020431L, "7 * 89326288633");
74+
assertFullFactorizationSuccess(586263075576L, "2^3 * 3 * 24427628149");
75+
assertFullFactorizationSuccess(864106952674L, "2 * 7 * 61721925191");
76+
assertFullFactorizationSuccess(926922993731L, "7 * 132417570533");
77+
assertFullFactorizationSuccess(718370101419L, "3 * 239456700473");
78+
assertFullFactorizationSuccess(34108147078032L, "2^4 * 3 * 710586397459");
79+
assertFullFactorizationSuccess(906984307049289L, "3 * 7 * 293 * 147405218113");
7380
}
7481

7582
@Test

src/test/java/de/tilman_neumann/jml/factor/lehman/LehmanFastTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public void testCompositesWithSmallFactors() {
7070
assertFullFactorizationSuccess(569172749, "83 * 6857503"); // 30 bit
7171
assertFullFactorizationSuccess(624800360363L, "233 * 2681546611"); // 40 bit
7272
assertFullFactorizationSuccess(883246601513L, "251 * 3518910763"); // 40 bit
73+
assertFullFactorizationSuccess(625284020431L, "7 * 89326288633");
74+
assertFullFactorizationSuccess(586263075576L, "2^3 * 3 * 24427628149");
75+
assertFullFactorizationSuccess(864106952674L, "2 * 7 * 61721925191");
76+
assertFullFactorizationSuccess(926922993731L, "7 * 132417570533");
77+
assertFullFactorizationSuccess(718370101419L, "3 * 239456700473");
78+
assertFullFactorizationSuccess(34108147078032L, "2^4 * 3 * 710586397459");
79+
assertFullFactorizationSuccess(906984307049289L, "3 * 7 * 293 * 147405218113");
7380
}
7481

7582
@Test

0 commit comments

Comments
 (0)