Bill Allombert on Fri, 03 May 2024 18:19:43 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Simpler PARI/GP code than this?
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Simpler PARI/GP code than this?
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 3 May 2024 18:19:34 +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=1714753179; c=relaxed/relaxed; bh=k3lu2MZ8MWwMhrZxXht67gHmprPeXaRoeuZ5Oc+ENxs=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=JjC2bl8bn3FpaWDT1n8VJ8Y0+2NYbyR2WNA+z09STMGizl2TKHO0nQdbbzbDzr0jWIVRQirG2mVh69yQ1+PIYG6txo11UNFZy9H2cV5geIfcm+aQFSlGBW+VR15A7UKY8IAZoA4RQcOz9QmRTY0lpy3e1/1Tgt5T+CaXvwx3vXMm/Wlddq7ycRvJBiacYcfOHZWiTYfuy9F1fIfDcdyVRAH2lVn6t182fr7ThNI7o0D/QQr6i6aRjikPZDvzH2BSUn+agAVvJSD5hRNf4p61NHOJM2K+Y9QLabwr0F9ja8dL2u7fF3qnyNWn44ULIJaVtFPjnm7dYcpj0eQGYPwCkNoWxtMRtA0sSESXvt4bs1JScCnu3zl/dtvHSB0wQZUJQMUwNl2m10b3x7B/Bw/mwV/PjDDnRefiJGp/QrhOw/vRxXCVu+rsElSXoKuly6AA/E6JBh4nCjfuSjOMWuqXxsuMlJyAbsjKiPYSC9SiSd0zgwUVeozUxs47SIuxDWjmLIToipOIgLfZcOKbzUOEu9VYhCL3iq+a0T1QH2mg+0vuLeY5Hl1FYSbov1vdSczgm6uQ58/nTdjwEHYcxwXKTBdpGb56U3qSvV86ljGKKgChF/t+mMzPKNMz63TPEmDFmck+gQduQOxFi9pYTT/MlJkYXgZqC7P1UsrNlBnXSlI=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1714753179; cv=none; b=Iu0UhbfEXkWZ8XbbxRGIWnCTz2b1+b+RFM/ssNIZGcMiS7rQK3C7h9opGv6GMrqcnwqDhAnAZJKFYjH3PXDgpeBkwGmLL49a9Nc+Yzk3g8dGiu4oYbv3lqGhwaN899fzkqoWw0Z/XE6iD73oG7tPUrH5398ggzdg5V3bPpipv/tvq5qhcZSCXixZSnn7nkt1eFY2Ili0GS/3mpMg9gzaL2LDO67aRXRRtqfG54dBOK91VZiAMztrfFoHjTjFyfbjj+Askivi1UzaVnzkmK/d5Lpu5SGG4V1gDVeqLa2AhZI+p7Y/ZnZIZdoX1jlDFkfGp66yz24f1e1GPr/mAR2GXW0u0LOPM7fmvCkunpE6prz58Axa1tCCDN5xXL+4etdDkHFkp25uvROs6k5KYXhzs0DXKJvXC7FWqDWgbUrNsLfS9ex2sktC/XwmopBv7v7uA+tDNyauJZ+SxPRixvZGxibngnELgSE1mL1rug3dDI4seZxGuHr8maZOHCmoZB8qdmJSi+yvQs5udQscY2rR09w+ASOck2UPpyPBcYGOVBpw9/PZ/Yglf7XouYSzCfO3Qax0Ru/lmVECblqjm6WmZhTbQeXqAZAA0mlVIoDfg2OBZKqn451vWUPe/cfYfVaR/5mCV6Cc0miB58GiYSC8bNyRAV2jFGIyRaxTaEFeUT8=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Fri, 03 May 2024 18:19:43 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1714753179; bh=k3lu2MZ8MWwMhrZxXht67gHmprPeXaRoeuZ5Oc+ENxs=; h=Date:From:To:Subject:References:In-Reply-To:From; b=FtDUx1AzNjxv9pkgGResp0nH84yI7lhaoe7XmVOG9sHeWarLb4124icol8mk5bGNl SrwIzmkxPBGYE2yCtthDivWb03FLp64G4L/4BadCI4iWdwng/Gf9vh0xigc6NFU84H OLBjHE9iihKAS2UYhc7LipmM/7UyRhh2zKJXujvJlzH5BMJosYX5RypNwosKveB0+S WaQFYNEoeMKYn8jGVuxPERo5ef8AzxaexVeeppcYLsukZe1g0Kfkx1ATxZslLrLBZk 2lvyV5XMyGdfgCwms5VHdlyeURVlHOlHbMz1Rmx9yez2vV/2mEzNRyMsIgagjFYu6d Rra2VCgLqL0xPOflhrewx0lJZE4dtUoYiVsv/w/KGcYPNYVGPinmaigLfcjS0RFSnX WWXtgh0MJAffqDkYrdc4Kga6u8W6BPMVVuOv7gXAh/Tg9zsVsIBYCs8b1+YCW4AxCd TfopVzSdVZ5VcFWtPddcOTLFSUxg2pPHsjj7Dkj0/6UhdUxqhh4L+G6Roi7NoONA3u LZ8VJAmop4a3FK8WkVlDWN/pHbL5yMDdREKyzs24eVCryp0W4mEJnUgzOUN4GUwCKL EE56Al72091627TW+Ek220CzJqc+YZggcopnNkH4DmkKlcYUoTOF2Q2waxEmJIleOE ByjB89NIIhfm3lqPtPTQFeZk=
- In-reply-to: <4be968a08ce106d91347e8fae61e54df@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <4be968a08ce106d91347e8fae61e54df@stamm-wilbrandt.de>
On Fri, May 03, 2024 at 02:52:24PM +0200, hermann@stamm-wilbrandt.de wrote:
> GIMPS mprime software creates ".proof" files for fast verification of a
> completed (long time) PRP proof/disproof.
>
> I asked about software to verify such .proof, and @Prime95 provided main.c
> and roots.c.
> The missing rootsdata.txt can be created with GP:
>
> I came up with this GP script to create rootsdata.txt, verify_PRP could be
> compiled and used (generation of PRP proof for 9.4million decimal digit
> prime took 6:12h (with 16 threads), verification took only 5:17min):
>
> https://www.mersenneforum.org/showthread.php?p=656165&postcount=7
>
> z(p) = znorder(Mod(2,p));
> o=[List()|i<-[1..2^16]];
> forprime(p=3,2^16+1,listput(~o[z(p)],p));
> {
> for(i=1,2^16,if(#o[i],
> print1("-", i,",");
> foreach(o[i],x,print1(" ",x,","));
> print();
> ));
> }
>
> I feel that rootsdata.txt can be created with a much smaller GP script, is
> that true?
It is not that long to begin with.
What you can do is replace
print1("-", i,",");
foreach(o[i],x,print1(" ",x,","));
print();
by
print("-", i, ", ", strjoin(Vec(o[i]), ", "), ",");
Also, if you just the latest GIT master branch, you can use a map for o:
maplistput(~M,k,v) = mapapply(~M,k,(~y)->listput(~y,v),()->List(v));
z(p) = znorder(Mod(2,p));
o = Map(); forprime(p=3,2^16+1,maplistput(~o,z(p),p));
foreach(Vec(o),i, print("-", i, ", ", strjoin(Vec(mapget(o,i)), ", "), ","));
Cheers,
Bill.