You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It may be possible to reduce the number of operations in the Lucas test inner loop. The C-P method for V chain uses 2 mulmuds and 2 submods for each loop. They include a way to do this for all Lucas tests.
MPU uses:
2+1 / 5+3 for Q=1 (bit 0 vs. bit 1)
2+1 / 3+3 for P=1/Q=-1 (bit 0 vs. bit 1, also includes more logic)
3+2 / 7+4 otherwise (bit0 vs. bit1, also more logic)
MPUGMP uses:
2+2 for Q=1, P>2 (with inversion)
2+1 / 5+3 for Q=1 (P <= 2 or non-invertible)
4+1 / 8+3 otherwise
We should also look at merging some of these so we do the best thing.
Consider using the inversion method in MPU, and note that if gcd(a,n) == 1, then the inverse should exist, so we don't need to include code for no-inversion.
The text was updated successfully, but these errors were encountered:
See: flintlib/flint#81
also: https://github.com/wbhart/flint2/blob/trunk/ulong_extras/is_probabprime_lucas.c
It may be possible to reduce the number of operations in the Lucas test inner loop. The C-P method for V chain uses 2 mulmuds and 2 submods for each loop. They include a way to do this for all Lucas tests.
MPU uses:
2+1 / 5+3 for Q=1 (bit 0 vs. bit 1)
2+1 / 3+3 for P=1/Q=-1 (bit 0 vs. bit 1, also includes more logic)
3+2 / 7+4 otherwise (bit0 vs. bit1, also more logic)
MPUGMP uses:
2+2 for Q=1, P>2 (with inversion)
2+1 / 5+3 for Q=1 (P <= 2 or non-invertible)
4+1 / 8+3 otherwise
We should also look at merging some of these so we do the best thing.
Consider using the inversion method in MPU, and note that if gcd(a,n) == 1, then the inverse should exist, so we don't need to include code for no-inversion.
The text was updated successfully, but these errors were encountered: