Bill Allombert on Fri, 06 Oct 2023 19:39:01 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: "my(...)" scoping question
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: "my(...)" scoping question
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 6 Oct 2023 19:38:53 +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=1696613928; c=relaxed/relaxed; bh=cOCYIb9x4sNXE6ynKjdPk0rE9aiEaPooWwfPWEaHZX8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=1bKT0bsAE0nQUEfrLe/88vRhnt2rv7rn1Dv9MXDXbN/paj9hl7Cua+sasPtRVeIRnSI5BcbZx3qQhYe17XI0rrhpa95rRSY83uo37HzvvLhr626uTGeuqwxDiCFFCVUYkHf5roNIgQ8KH5LDjbh3CDm8pp/cdQSHYv65RcgGR0bcdacl8+PqABIEoRPrRTq/y5izk+fQ1+bsnGyK7qKVw0XhcEa4DIRMckBPDEVgh7123AAWl42MdccKNm037Fr9L6Dp2do6YS5fpPmeNe/+n9GV+DHztCrvfuzFT5DzdSn5pX928aSgu4xCqpbaQK07avjDjP4hpO7n5tCb3Leb0FLPesXSd+x7FfwAPMrOX4mt7BkoqqB/ZJKzBeBVJvoBUsH635svAFXJqmtVG9IkcTj0IzhLkMgHIchd6eLK5jYCBYroWzNpCIS8b8c22lRcUGkYpZlBROVDSomJNWKdhIg81MWA4SAHc1E9fgySr0yffPMcqreAFHwdBIaCtYmuU4w5Ajsqw0RT88Rf/m+aBbVgbA1mHEDioPG4lDOBY5tcT2uTh4GXvB4NcokLUOC62bSLUyfj33KO6JMMwOodHAAubE5c6VllaAm8dhWMnqcGQiqXSzTj5k8GhMEW/OdEpnENM+6TdAE0wLgO1AxhbShsvOoVTZyomZ+TrwdFD3A=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1696613928; cv=none; b=VkMnpTOVbhbs16Lv68R+g7PzCJ7aZQxqjiVTO24c7LQ+h35xmvVEdb1CGDKWaL160uVjlFeJ/fP4Px1HZCMNhwbVYRgTQzk74yw0r0MIKpuZRYGmUuhW/EAzYrkrEun9s46JUg4qpX5uKZLtxAXMtvjgVyR7UZKwcqlIERZaNJAEH8knZV732lzQptx8qnOZ7j0uA+ez979RsTUuaUN/Ip4XMk9Cu558E0+zJHSL4l4W7RuovCJiuPpViZK7+/lEwqHEt5xlq61GMm5JJshxk3G+3DzD0Ps9rZTfPwrd6PV+YvVIo8pZ4eQH8Cj11e1f5eP4bgcu2pgYaH4p97vXgdCdf/7Qq5ENBWrT3LQShQm3Gp0ChiBBKvpLEnvjsR0Ooy2Bt8Rw7vRg+YRf/gdpXd6Tn32yVRJYWhpXv198O33sHfd7OVcXrJUYfaeVxTGX7cNfz6GQ0qkXxqrMDg/+XFYEhHUThsM7sPb/RSaH41MDHxpHP2qGPh6XVB0MZZsQr5V+oAuTNzHtWhXsuFL5whfqi4w5BimG8TdCohSHEgbtjeBD3Wlk5sC+tnmnVPIxylrmqFKt4N1la9jj68YdWJvbjA36RK1eJM704532z8gpDf4MYhmFhfn02LqYv695XfFR98DOzxWtrLPcdrLMrf33T5ouMY1jaz5rWsXuJtg=
- Authentication-results: smail; arc=none
- Delivery-date: Fri, 06 Oct 2023 19:39:01 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1696613928; bh=cOCYIb9x4sNXE6ynKjdPk0rE9aiEaPooWwfPWEaHZX8=; h=Date:From:To:Subject:References:In-Reply-To:From; b=KllVdV5CD9ZyEC7YIXzrvs8NY1MOnAzy5q/7RDEcsJ6uuWBb5XJuTFJmJoFSM1Y0T BF+E4jVZOEpDeN86G9V73BYW0yRUz8wj3hOyI8PneHMpnmLpUsxe54sju8B47KGmb9 UykTxuXAl36TAZAco3naRRImLuIRrcYcKc+H4ZsJBcDFRh4Py08g0/pFx0jKVCttYJ LvCmnH6QFbNVu8fyLBB4UIQLDph0BOKiYDuoPRE83W8LTbc8CAmcuDmGlpMjLkGvgI WwK1EJRM5S/9+RcCbR6tDx/oLhfYf2T7qYUF9l1V5ZuIqoDFH9T7rYK1M00NJXDjXx I7bEav+kYzsXRoVZUSf5L81sbcu7UzhXMCZSP9nAxwaSGF9qMjtWkyMF/IubQFO7Sl QN6SdOhILJ8Y/T1198PEi3k95qxjQAT9IKTsvn3xTeilzCFJ3CX0r7EHpVw6YZkufW 18G4y2E9/ntl8/GUCxBSfURQrR2kWDqpAvG1nbIu+jxEvvbRJaDoG266a4yDkOOCZ9 h6hI7BHVxYehJCx3I1MlnnQYntXWbjfQEGLfPCbl7K4zyVwyOsaDpIntD3MSTtIfPh 5QKarfW6mUbWErwRTEmgOET2FR4Fz4YohgGTt1M6qbisQhN1lLXtMquhtweCSIc5pw sCgwTeWga5+UlXawyzFyqepI=
- In-reply-to: <12ff0e7b9b60b252ae4533dde891ca33@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <12ff0e7b9b60b252ae4533dde891ca33@stamm-wilbrandt.de>
On Fri, Oct 06, 2023 at 07:14:33PM +0200, hermann@stamm-wilbrandt.de wrote:
> Running this GP script
> https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/pari/all_rsa.foursquare.gp
>
> all is fine:
>
> $ gp -q < all_rsa.foursquare.gp
> ...
> 2048 [28, 158197984288196117699097355897947500264458455190848222964138664214873348733353898043756194523483689509093385743402168573089458743256253901017830264069606012704497883085623209455523704906878923700142603965513457096959088734082854043425944788477935555382589380809038501009740812793032665236884977009980514922487, 13011773238477059231321994244187743729468594581843753487082884034603212622185946597112257777907861613001484624197063577339843512098442794834693496703933881475402708427339094714589624392731377779402228770755581888942318831433232790010161732825667949844267841944332119616646371761146340753071052451512068626398,
> 0]~
> *** last result computed in 3,373 ms.
> all asserts OK
> hermann@7600x:~/RSA_numbers_factored/pari$
>
>
>
> I added "if(n%8!=7,assert(F[4]==0));" as last line into main "{ ... }"
> block (to prove that really sum of 3 squares got computed):
>
> {
> foreach(rsa,r,[l,n]=r;
> my(F=foursquarep(n));
> print(l," ",F);
> assert(vecsum([x^2|x<-F])==n));
> if(n%8!=7,assert(F[4]==0));
> }
>
> Although output for RSA-2048 as well as vecsum assert are good, the
> following assert "thinks" F is a t_POL:
Your code is misindented, the 'if' should be at the level of the 'foreach'.
The scope of my() end with the innermost closure that contains the my().
What exactly is a closure in this definition is a bit more difficult to explain.
Here there are four closures:
- the whole block of code
- the third argument of "foreach "
- The [x^2| block
- the second argument of "if".
So the scope end with foreach.
Cheers,
Bill.