| Bill Allombert on Sat, 12 Oct 2024 21:37:43 +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 21:37:39 +0200
- Delivery-date: Sat, 12 Oct 2024 21:37:43 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr;	s=2022; t=1728761861;	bh=kKXnEFdCmnTxtfUhVvIRGojgKtUIVJc2uiEMtWlEU/Q=;	h=Date:From:To:References:In-Reply-To:From;	b=f/MBXkl0kWRgtxqzYVFDTX7Pzlcs8SXb8Eix3lykluK2TPA/6Js6E8tXB2e2mPPTL	 iiszA0lZZHdwxdQJfJ2LkCeqIc70zRGscBKbnMlSbDQ/AxIlocUJoL/vnU4IKNHrP9	 /C1XSYwJX8iCFrJNz4K3berKXaJGiLhpWYqvM3wpBi+Ub6XJ+2yPtMTo1ox+B0peOp	 ocbdq/XNhHVq7UEzOJveeAwfe+5nuWa6RtkXl08b1bhcba+9d0LsqUEpmFeaD7MnXn	 P51nF/9HyGDcEPI3SX9b7s8ob8VkcJZ5xBx9RBzU7/zypmnH4RRnLc8LAhHmU4i7y3	 2OcDT+b1nARQyOs3GrbL+3iMSFhBsodTGXZMkVQSwEhFdQSmSm3sS44nkDC+HDHJLg	 6HnFcjOMZxi+pHqbKkSTDJRWgv9ZFcGPLEjQbqLnBTMZj9U4royycbq4ZGC828OA8Z	 YfGr2mlL1xc9Ox4Aa6LCOULSxZAqlY5FyGk0/5cWrKNGI0S+dyEV/WwRUpYwopIcVd	 AjXaTAH0ScN6spKS2iRCar7yAJIO7+2Ow/XHrRLxtW4yKEvPQkgGUbMwJB+xdjIZ2A	 M5D/pQ0yb5Oou71Sphz1hTynvglLYmDPnmm0kFIaOK+OldOckaejbAcugpmKtDC590	 Jrsa6y/e+7ycEQs9160sJKm0=
- In-reply-to: <CAJkPp5OxDLmQ7fz1pOGZdjiq42kJPKsRGc2Gi8UFLQn_NkeM=Q@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5PxxVZHXM02kNfJf1aV0CYdRoBgZ5YkKNvHbHF4yCXHqw@mail.gmail.com> <CAJkPp5PGak_wPOMc0zCqOOTBKgxSeJHCYFV4BUYS=HG69gC9Hg@mail.gmail.com> <ZwqZ7jEZ2WLgk_MP@math.u-bordeaux.fr> <CAJkPp5MXdZnE71Fj+RWy8LMgF1RZc2rLWJOtbA2gng2jL09y0Q@mail.gmail.com> <Zwq1T58sleAP1_t_@math.u-bordeaux.fr> <CAJkPp5OxDLmQ7fz1pOGZdjiq42kJPKsRGc2Gi8UFLQn_NkeM=Q@mail.gmail.com>
On Sat, Oct 12, 2024 at 02:52:36PM -0400, Max Alekseyev wrote:
> Bill, Karim,
> 
> Thank you for clarifying the distinction between the factor_add_primes=1
> setting and manual calls to addprimes().
> I have a coupe of follow-up questions though:
> 
> 1) Can the threshold 2^24 be adjusted by the user? If not, I'd suggest
> using the value of factor_add_primes (when it's > 1) as this threshold.
No. 
I picked 2^24 so that the primetab array would not fill up too fast.
> 2) Even with all known prime factors of the modulus, the performance of
> issquare() on t_INTMOD's is unsatisfactory to my view.
> For example, the code below computes the number of quadratic residues below
> 10^5 modulo the same modulus via Zn_quad_roots() and via issquare(), and
> the latter is very bad.
> This makes me think that issquare() on t_INTMOD's with composite moduli
> should be totally avoided unless it's improved. Can it?
As I said, addprimes is not meant for small primes numbers.
The problem is that we cannot allow N to be replaced by
[N,factor(N)] in issquare since
issquare(Mod(a,[N,factor(N)])) is not valid GP syntax.
In C you can use Zn_issquare/Zn_ispower
? NF=[1000000000000001000000000000001,factor(1000000000000001000000000000001)];
? install(Zn_issquare,lGG)
? sum(r=0,10^5,Zn_issquare(r,NF[2]))
%5 = 9425
? ##
  ***   last result computed in 51 ms.
Cheers,
Bill.