How to handle N=1
$ echo "1" | ecm -pm1 10
Input number is 1 (1 digits)
********** Factor found in step 1: 1
ecm: auxi.c:169: process_newfactor: Assertion `(__builtin_constant_p (1) && (1) == 0 ? ((f)->_mp_size < 0 ? -1 : (f)->_mp_size > 0) : __gmpz_cmp_ui (f,1)) >= 1' failed.
Aborted (core dumped)
exit 134
We can skip 1 at input time (like 0)
$ echo "0" | ecm -pm1 10
Input number is 0 (0 digits)
Error, n should be positive.
exit 1
or allow 1 as a factor in auxi.c
-ASSERT_ALWAYS(mpz_cmp_ui (f, 1) >= 1);
+ASSERT_ALWAYS(mpz_cmp_ui (f, 1) >= 0);
$ echo "1" | ./ecm -pm1 10
GMP-ECM 7.0.6-dev [configured with GMP 6.3.0, --enable-asm-redc, --enable-assert] [P-1]
Input number is 1 (1 digits)
********** Factor found in step 1: 1
Found input number N
exit 8
or change 1 not to be found as a factor in factor.c
else if (mpz_cmp_ui (n, 1) == 0)
{
/* we consider n=1 is fully factored (thus in step 1) */
- mpz_set_ui (f, 1);
- return ECM_FACTOR_FOUND_STEP1;
+ return ECM_NO_FACTOR_FOUND;
Input number is 1 (1 digits)
exit 0