Bill Allombert on Fri, 09 Jun 2023 13:09:27 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: efficient determination of smallest quadratic non-residue / t++ works, t=nextprime(t) hangs
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: efficient determination of smallest quadratic non-residue / t++ works, t=nextprime(t) hangs
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 9 Jun 2023 13:04:45 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1686308676; c=relaxed/relaxed; bh=PGpzQynTnhOlwTZNMMBoqfQHmqcIHUtXDyQA2vBg4FY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=20ONq0UuAFVrf9XUuEyOSt7y0vGkNXRbtfSs8XGvZm3Y0+hfzNHcJvFAabO1o9roQhu5NmABESFth/smxQNvxLsR1TRCCvgAJA+EWbdzg1gicJ3RXuD416/KrnUu+zI13aup03xjmIXRDL1HvnoX+3YMr6o3eXdRCpZpQyl4NpsLOq39VmBxSMjaCa/fejrq+LEnn1LNzBtzeFl5BgNtniy9dzFNhvAHQz30sWIAj+qXGjQ+UI1xvf68YabzZ9DSt35AboxXzHRXEby2sPUzhOz6/9aZc6T8AQNeYMD2UsTELqYZQWaOnPwWPU2+yCGpGbRaSvtXzhizQclDQnUrTnfFhA2yJ465hjrIeNrudiNsmvL89nkmIjSpUrrq8EKRXsEt2RZIXHad9TykoWSBm7qCnao0AIx1q4ccb7PpbkYGWXMwASQx9/OgdkHDP5/LcR2KeFdUARwhcuWy2n2E7r4x3CobLulv0y9NY6VvUledOTu/nWaxi8PR2JT1jMsxYUgMBasNNnzGJv5vr6h/UfrU1vlvPQMOGPNWaOwWQ7CymAxTxRrgBUNEvjJEEFUq6UZ6qLlPFbTzOxdoQk0G9daSUWuDW/dp2wYR1zdxWx7aEOca+X304mSH+qsIZy8hkYO7M4FDYRvKyfG7bIyzsOqlKdfv6InA+01bWn9icKo=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1686308676; cv=none; b=mI37AW8ZsUjqX0tHKs09ZODnuLZICK0jdfZuLEhLXlVecCZVUzTgU976R+pfnsoO+jJ/NnNxKz/2vnxgMwemtBTMmwUSuT8rxIiC4qLFQgRMTWpGtniCNGle6FneYU+5ziECyN+QK/saXI5Kdc3rQU1q/5O2R8ExzqP8QX7VB5ADYkHjoFPOJbAlvYRDFGN09XwH/RmacTMWYsM99e6HF0rCuwP3wFQ3o3RpmzDnN7NpFas+FzPVwYFKqP4CCCounf2eWxRRMjgdF7oVRfI/DFCyPowk9UJB79PJMRGCWJccu8MQUgkUk2p/TJr4lP7NISbH0fpUH8XLcs2Xw1z40hn2JGk1F02UJHfSWZ0KiQR9I0tei2uzWwJtgzXp4ynr6yCKrvl9BAlY5JjUxJfovQmZRPNd1h1TObHGgNgQtbRCY0ulWKlACfSVvOSmG+8JGf6Fp99NsveH2dWy655vDyCx05j8xeUnUiHI98kznWEtGS6pIu90VMx3PQHZLOcobHCxCJQp6R2DsgbItkdihgPywfIOLBH7ntJMs/FbiQjcdXjxjLFlU2lcea477D5VQRUgOR7Yei5xs7nmr5QAPKpyBvIim0DZUhw5IQqlF2g2zJFZh51cZ8jzUlO1RUxnZUurjMQupNMsKzJNXZAxZFuS7OC5Nkv1cYdfFLooW58=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Fri, 09 Jun 2023 13:09:27 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1686308676; bh=PGpzQynTnhOlwTZNMMBoqfQHmqcIHUtXDyQA2vBg4FY=; h=Date:From:To:Subject:References:In-Reply-To:From; b=fB5yQeeHncsP8SVxwLCH2GZRLDyIJrzoMXLTrVVWTXTu91/N1oAuf2tUysSNxNMlc hGVGc7y/UR0DCfiYXHMXE3zohwmQFbofYV02mLTW3tP5e9o83G/1hAr3ScjU0bzwo2 RE4PYn0Rox61MUcL8utfG0/pQNYaJLmLiZf15ZPoazJWJRNfy9rzi3S97bU81lvsgB 0gPBtdaHxDR/eHLH53vZ/bHOhic2gfOxExRvMyokwQIZpyvoBk8XdfZsnzmhyQyvx+ idc47DeyWtWdvnkvriMMMsHsvIXQVh9OSLJjcxB5VoTKHE2WGut0zaPTQ/p8kw++KL f2Uqyg/eKhjxd/1d8ztIgDelvk+BwmumvSmNhk8KsjTRoxtSZHgBT0SBD1tIfgSPX0 +q6lc0V6xxqTjCAwC3DedYiUsBUmc5czFv11T7U4tttCzaUz/gDwUP6YTIUUPaauC6 vQ0Eg5SNYnaXjRPAHcBExVtqZ8UZ3eurPqpjWl+SKLmqhb+Lv4GHOThs74iuk69OdG 89ANFR55OhajcXCghlMbKj40yqSFdwHpfo2sFZpEc5xn61ISINk9N7UtmCD7UESu/b Kj0X+lUp/OcWYoKF1pE4TLg3ataSkeg7OSRIRladIvygzIZPKtIoC8ZsGax5606Hn2 Iu9xfX3vRovckjUenCyZDSOg=
- In-reply-to: <f56c7f72f519b5bf76e05837dfce309a@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <f56c7f72f519b5bf76e05837dfce309a@stamm-wilbrandt.de>
On Fri, Jun 09, 2023 at 11:26:25AM +0200, hermann@stamm-wilbrandt.de wrote:
> 1)
> If I replace "t++" in
>
> smallest_qnr(m) = {
> t=2;
> while(kronecker(t, m) != -1, t++;);
> t;
> }
>
> with "t=nextprime(t)", computation hangs for the bigger numbers "n".
> Is that a bug?
No for historical reason nextprime(p)=p, so you should do nextprime(p+1).
But it is much better to use forprime
forprime(t=2,oo,if( kronecker(t, m)==-1, return(t)));
or
forprime(tt=2,oo,if( kronecker(tt, m)==-1, t=tt; break()));
> 2)
> Is there a better way (like C/C++/Python argv) than I did to pass value of
> "n" when executing a script with "gp .... < script.gp"?
Not really, but you can use environment variables.
env GPARG1="3756801695685 * 2 ^ 666669 + 1" gp < script.gp
and in your script do
n = eval(Strexpand("$GPARG1"));
to get n.
> Is "if (type(n) != "t_INT", ...)" a good way to deal with input errors?
Yes.
Cheers,
Bill.