Bill Allombert on Sun, 24 Mar 2024 22:07:43 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Question on PARI/GP realprecision
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Question on PARI/GP realprecision
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sun, 24 Mar 2024 22:07:34 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1711314455; c=relaxed/relaxed; bh=LhCKFjmrDuR6v9C5/cWaT0fSffIPTnn6xNDwjG3beKk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=0lsviK4d2I8M86EaHvDcWPjcgtsu3NJArgHaS9BFVBGVlJgRbqSpWBhiS6MCf4YcPluQomN+9vvN/2HcBBjax0XKB6dVqWM4Vmf1WO4u1qCdyLgSECcMiUBCLSKknefOuzNhKXU1xnnvttM8gneIeOC9YHr5wrsG4I2bkmwQKt7BDDBb5ZUNybhcLaC2YiZMvugktSnCS4ux8mTqMDjkhpphY12FcwE9BLYceFz4dgHLxk0NQbFsCidz+TfgMPQo0Dui4tRQwRrCD7DGumOlbVhkNJhf/S9RiNygDd3vRQERe2vEY165s9u8p+zn7AbxZzcVqYQoBwIFaLyF1+a7jW7xiKS9uXHFHh9csmRNdElSh87IUDpzJZkMNwh/GEvaQOyPAUqMNrjqhgySRSNtKsIzo3EUKaPJgxycYxNKrdI2+7Mkn92CSiT4YdUwkWSldw+60k+RsBZfxtWHpbjbP9YgOCkIqn/0eRjdQ7iQvxmO7sw5mH7/62c1i8NXGtWtPWbB36UkTTakCAui0PN6WqBVsFrXB1yODKo4YxbwsTmCv3aG1+Q5NPIj4lycTixs71NEXRUbgzJrfIq0szlvqRcIBUNV2A4SmX+0BGVdt5HpM4rMlYQOS3uoyudioFrqh87KXhDxMzmmL5haX1rwPvwXgcai6/0iu1HWfx1+PVA=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1711314455; cv=none; b=StWfznZzRSh247jgfIH5919NR/n5vebrfwj1vejxGOJ2e3HDHDpy/egxb9bwZpyu1gF7ZcZH6KdGXTg1Wcd6f9aDCwo5OSi1s0VCU0c5+q/luwZNy/kTALU+50xb75ZMfIX16Lcnq6NZZQIp9KsNSFtsTfx8LpypNFkYlND5YotoadYoncKB+H5HxWimKT4EbLv4TeOqPNLerbZzXMH6+YcjbAatn/ZJJjBgvj02iv4oQgdw050nq5stv2K1oyK0O1hpEmG0PygZdlB5/6u97f+ZpnRjfagcMb3nNtOzQ+GLEDI1OKvuQVWa7Mupk0w4BYxCnQUVIs1z0Tqku1DyUBXiVALyqxy5kqfSp458MuCJDOCTlKiNYkms2Vdhs0IneFipgq9YxbaHUznVtKXl0L2mfrmXFIbiksVOh2YviHWkhDlJMe54f2OyoP9XKNOCZHFEQGk+6boiSOtElCBdkVc0uuVXjGi9ocHy+Gjz7LIgJSawdpdE5mbpX/raXhryaF0IM1pcuYlxQRI8vAMYeJcncpqK2yYpOMZ7BmOlZg8kpb38nezNfrZpdJj3BnDgMIuGgHl9Dr6QM24objLIZLV2vZ/2UUHk6KQLHewLTNz31lY0g5fv42ncSUir0pfOV+wt0jiT4UK1JbM4zfj/v52K7kTnnPKcWp0He4EQm6w=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Sun, 24 Mar 2024 22:07:43 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1711314455; bh=LhCKFjmrDuR6v9C5/cWaT0fSffIPTnn6xNDwjG3beKk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=k+zOD9hzKkyk83+k3kMNMCUk3vXY3balgQ45MmRfs5MGp7xGKze946yi1w3ue+1VI 1B+2u1A+18Zi1uAyBzMVD3/6p5Xd22yw7m+x15tnOk5+teZLHIFdbhxMbRazMtlDhe //d+x8XRi+TqBRX8uyfrxf7i2gMl5pd+5O2ssACt2EDuJ19qyng1xp91gb+fknDo8L yPyx8ZDxbcid8J/XmRAtgetxtJ8PLPTytV2bJPDLa1aA37MU9+ebTLkI912pAi6BAF cdT+BFxQV134NGXVCZyo5KGT0wW0MBnFTIYBnsZ1WDEU6cf7RVrlH8eIt9mmia1doK Ae8Qe+mmvGiBYtlOTao4sRqfVnqMcoVgTu+/m6A5YEXzjZN9IBVkLQR2Bp++R58nvz 5eFliKE5sHUgHBtHSxF6BwyCfDy5Y5kTtKK3jZmHDNcZL3BE9SAlqTwdz4mJyx5Fgc MVPbvEpnxpIZK1rSNOprgtnPwNPzUpjFZSjivS1stYwRNarWOtpKUis4vXoLOmf4sY OAeriR0WAIqZCMqS7xluwkIUtFndDbJcwmBuiV7yC1a/IgBvIw162TxnwANZpED+m5 Mt7WM3PjxGBXR1QNuKwRizbrAEoB9lkOn/q3flmWnSd+S7vkioFUTnzycKnpcosKAi wNB0XTpsj5oyAMjnfJSlXwBo=
- In-reply-to: <d49fb144d34a0356b80aee20cf679cae@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <d2644b89c9b389cf88bb8559404907d7@stamm-wilbrandt.de> <Zf/qHrPeGOUhMCRi@math.u-bordeaux.fr> <d49fb144d34a0356b80aee20cf679cae@stamm-wilbrandt.de>
On Sun, Mar 24, 2024 at 08:59:37PM +0100, hermann@stamm-wilbrandt.de wrote:
>
> hermann@7950x:~$ gp -q
> ? #
> timer = 1 (on)
> ? P=extern("curl -s https://oeis.org/A080076/a080076.json.txt");
> cpu time = 118 ms, real time = 1,417 ms.
> ? s=0;foreach(P,p,s+=1/p);
> cpu time = 18,464 ms, real time = 18,469 ms.
You can do this much faster by summing pair-wise recursively.
Also you can avoid all the gcd by using the addition formula
for fractions without reduction.
\\if wget is installed but not curl :)
P=extern("wget --quiet -O- https://oeis.org/A080076/a080076.json.txt");
{
Q=apply(x->[1,x],P);
while(#Q>1,
Q=vector((#Q+1)\2,i,
if(2*i<=#Q, my(a=Q[2*i-1],b=Q[2*i]);
[a[1]*b[2]+b[1]*a[2],a[2]*b[2]],
Q[2*i-1])));
}
##
*** last result computed in 249 ms.
\\ It is easy to prove that Q[1][1]/Q[1][2] is irreducible,
\\ but pari needs half a second to check it:
t=Q[1][1]/Q[1][2];
##
*** last result computed in 542 ms.
s==t
%5 = 1
Cheers,
Bill.