Bill Allombert on Sat, 12 Oct 2024 19:23:51 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: computing all square root modulo a composite
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: computing all square root modulo a composite
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sat, 12 Oct 2024 19:23:47 +0200
- Delivery-date: Sat, 12 Oct 2024 19:23:51 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr; s=2022; t=1728753829; bh=RpvL7lO6CvkFzXNj8xIDU4j9k4BVctesKDZYfp501MA=; h=Date:From:To:References:In-Reply-To:From; b=jHuZeRXlKmbpwmyTPdaSYJRhnSEMWgUB0SwQMnSiIVjAxCxy388F1wwkV31DXJ/To KNQh/Fj/daI0KGudHFGgCxd6rFvNQlUjO0I9XxlP/mao6+EU6sYpe1wcXeBGaaN4pD Gj0XbXW4rvIrQ4q/413pmU0KSaMuPXLmK0JYJNiuMCe2L6kA5Q3vPofCUDPNFEl39e dJJydjNPM5chyMYM2IzF/Br2T2P/kV4F/yIXp10n8019hLLmDZQMJNPOwyH6coAUhY B6UQBnB5Rs3RhNH7a5/Jhekm3CtZsYTzVfgKPq4TW4mpLAEOAbU6LQ1Txz2y2Z+h4L Jeklrq47pEnX8hJN6em3+hiupbu7qYlQxuSK97aE/IprK1ZAxhMZnCU+cDSaIyp3dh N1mzSuMrB1XbVUKM9ZqNzoYymhKTRzMZFhd6JFQYOhV7Bm9nCszJ34AkCaKUxotT1x t0qJBU9LQOrSiak5CnK3jHh9aznbLF8nzclfkjg8l2vot4Vwznj9CHeC7nCoScVx+L 2mHYtbf/pN5hemSnKoav9zKUHwty8rei4m1CUWscNWvvoOX2OVnnc9r1qwan4DvMQN +3upSXAyUlDuS+2F4EoKEhO6GXVFxEGPqN+0L52L0lEj8PQTPM9PHfujGwf9KIVrG7 7fWxEEAa53KeLk6xBnrrzJ40=
- In-reply-to: <CAJkPp5MRAmZjLD_1cxWhCSvD38K=u-U6tLr6p7chzy8a-8OT3A@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5PxxVZHXM02kNfJf1aV0CYdRoBgZ5YkKNvHbHF4yCXHqw@mail.gmail.com> <ZwqYkqFSUNZekIwn@math.u-bordeaux.fr> <ZwqbKfQ2xC_9ldII@math.u-bordeaux.fr> <ZwqnAAZeVuTFjgn5@seventeen> <CAJkPp5MRAmZjLD_1cxWhCSvD38K=u-U6tLr6p7chzy8a-8OT3A@mail.gmail.com>
On Sat, Oct 12, 2024 at 12:52:08PM -0400, Max Alekseyev wrote:
> Bill,
>
> Thank you for the idea with isNULL!
> Now, PARI does beat SageMath when Zn_quad_roots is called on [N,factor(N)].
> However, PARI is much slower when Zn_quad_roots is called on just N even if
> default(factor_add_primes,1) is set:
>
> ? default(factor_add_primes,1);
> ? install(Zn_quad_roots, GGG);
> ? NF = [1000000000000001000000000000001,
> factor(1000000000000001000000000000001)];
> ? myisNULL(x=[0,[]])=x;
> ? sum(r=0,10^5,#myisNULL(Zn_quad_roots(NF,0,-r))[2])
> %6 = 111953
> ? ##
> *** last result: cpu time 283 ms, real time 283 ms.
> ? sum(r=0,10^5,#myisNULL(Zn_quad_roots(NF[1],0,-r))[2])
> %7 = 111953
> ? ##
> *** last result: cpu time 6,970 ms, real time 6,974 ms.
? factor(N)
%12 = [3,1;238681,1;333667,1;4185502830133110721,1]
but addprimes is not intended for such small primes like 238681 and 333667.
In fact factor_add_primes only keep factors larger than 2^24.
? N=1000000000000001000000000000001
%8 = 1000000000000001000000000000001
? addprimes(factor(N)[,1])
%9 = [3,238681,333667,4185502830133110721]
? for(i=1,10^5,factor(N))
? ##
*** last result computed in 1,552 ms.
? for(i=1,10^5,factor(N,3))
? ##
*** last result computed in 46 ms.
Cheers,
Bill