aleaxit / gmpy

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
https://gmpy2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
506 stars 84 forks source link

What is the paper that `is_extra_strong_lucas_prp` is referring to? #443

Closed haru-44 closed 9 months ago

haru-44 commented 9 months ago

The is_extra_strong_lucas_prp is described as follows:

https://github.com/aleaxit/gmpy/blob/ac1e151b8a818c32c04bf0cb9c9ee270b81b9471/src/gmpy_mpz_prp.c#L953-L959

On the other hand, the paper defines extra strong Lucas pseudoprime as follows

An extra strong Lucas pseudoprime ... such that either $U_s \equiv 0 \bmod n$ and $Vs \equiv \pm 2 \bmod n$, or $V{2^ts} \equiv 0 \bmod n$ ...

The U_s and V_s are and conditions, not or. The same definition applies to sympy and OEIS.

Is there any references that define extra strong Lucas pseudoprime with or condition? If not, is it a bug?

sympy/sympy#25826

smichr commented 9 months ago

Grammatically, it seems like the statement in the docstring is wrong since a series of or statements would be written as "such that either this, or this, or this" while what is written is "such that either this or this, or this" (suggesting that it is actually "such that either this and this, or this").

casevh commented 9 months ago

It is a bug. The original author of the code published an update that I did not fully merge.

I am double-checking the logic in my version of the original code and will have a fix soon.

Thanks for the report.

On Wed, Oct 25, 2023 at 7:36 AM Christopher Smith @.***> wrote:

Grammatically, it seems like the statement in the docstring is wrong since a series of or statements would be written as "such that either this, or this, or this" while what is written is "such that either this or this, or this" (suggesting that it is actually "such that either this and this, or this").

— Reply to this email directly, view it on GitHub https://github.com/aleaxit/gmpy/issues/443#issuecomment-1779426541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMR234LBBWD7THNSCWKSKLYBEPYPAVCNFSM6AAAAAA6PNTNVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZZGQZDMNJUGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

casevh commented 9 months ago

I've committed the fix.

haru-44 commented 9 months ago

Thank you for the fix.