| 
	Karim Belabas on Tue, 25 Mar 2025 09:56:35 +0100
	 | 
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
	
	| 
        Re: question on trying to use quadratic residues to eliminate needless checks
	 | 
 
- To: American Citizen <website.reader3@gmail.com>
 
- Subject: Re: question on trying to use quadratic residues to eliminate needless checks
 
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
 
- Date: Tue, 25 Mar 2025 09:56:32 +0100
 
- Cc: pari-users@pari.math.u-bordeaux.fr
 
- Delivery-date: Tue, 25 Mar 2025 09:56:35 +0100
 
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr;	s=2022; t=1742892993;	bh=ih5xXpWJJdLX7jJTy1aJZ2Wvoq17DUCwlq/R6oXyYsk=;	h=Date:From:To:Cc:Subject:References:In-Reply-To:From;	b=uByXH5XHrDweu5LHkvGei3sKCBGvXUSAkAMuf7hSnZnyjA60oNjRIVhvEA/Hwzupu	 QEx8VaPFxZ+tRwZ6H7w87PVdUoJ3XBRNAK1fK7RcFaMUhNOqqEqGn3Yon6aTwqeW7L	 6SVbb7oZy+7FEQLyY+EFT7jBrwviemEDH3WsP7NkRfTllizsDgwA09XDrqFqKFhwqP	 OMHKP8dQakocXHjqpjjPkgE5dC4CjOWjYcOxDNKsraNh6RpHCtD5Nw3W2z4bKd5MR5	 Pfxo3qyX7E27OPwwadnokjio+NfL+m6mdnlA5GQpMJb8K+HPpJnwQzNoJy2lrYmUBI	 F4Vu88B6ywf4bw9Av9LQ4ALbKa5resB25HPLHxtLvRszpuIyDytrm3AKvbQNY7AdaZ	 5heYtAAaN9YsoIkTDLLREHCSRfOpJByXnz2WdPjxbgdegLf8M1edO+P68FqfD9bZip	 pG6i55GIOKN5277LPgLxdq1ZNmPwllU5Wh2Sac3TNNmCRCPjBj+2En+fnuPXZ/fvpK	 Uy3CGcZslxKPKRuvjrmwYrU99opSMJ83lSdBYh7AAxrUj2xLroc3GjPSvWUQmNYZYh	 K9DDfSjA7gTp1sxCes75jAIBCEpElyTLCk9dsXAWSrfK+bDb1bMTNKmUWxxuU4ZQDn	 1F6Ijj0g/Io7GL7xP/OLk5gQ=
 
- In-reply-to: <0d4ed009-87c7-484e-ac2c-7bd85a0c18df@gmail.com>
 
- Mail-followup-to: American Citizen <website.reader3@gmail.com>,	pari-users@pari.math.u-bordeaux.fr
 
- References: <b10082d5-86e6-496d-9f11-4ef3223b8158@gmail.com> <Z-HKJ4Gj9jgnmVE6@seventeen> <0d4ed009-87c7-484e-ac2c-7bd85a0c18df@gmail.com>
 
* American Citizen [2025-03-25 01:09]:
[...]
> > This strategy reduces the number of full tests by a factor 1/2^(k+1).
> 
> But am I still facing the (r^2+s^2) mod N cost?
Certainly not: you precomputed the r^2 mod N (and the s^2 mod N) separately
[a linear cost, not quadratic as your number of checks]
Hence r^2 + s^2 mod N is an simple addition mod N
  ulong
  Fl_add(ulong a, ulong b, ulong N)
  {
    ulong res = a + b;
    return (res >= N || res < a) ? res - N : res;
  }
Cheers,
    K.B.
-- 
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/