Bill Allombert on Mon, 22 Jan 2024 21:05:40 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: log_int_rat
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Mon, 22 Jan 2024 21:05:33 +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=1705953937; c=relaxed/relaxed; bh=7XXJ5TKkHaqDV+greaFlhfneNVHbEvJHhKca0lf0b0o=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=Lejk4hWgsNas2sCwmKkqQxn+rKMENx0OH38G66NOAlN3hvCMYTSM8MjE5lCebxQuLrxrf0KV7ASA9F7dM/PtgkVJ7kYlD+nZ1SgnFPYrCAQm7pW67LzpJIGlVHMDCBo0Xfym1vMDvn8pfJcN0GK/baYajkxkveqMccWtPcLN7XpNDpFh2CeV0WWyyVOmLNGd6T70Cv/FcBDo3VsXmYpIuGg+pCRXkc7zhbWbBF6RuvqxJPaUJUYW7xXSlfYR9qGXob3KqK4/AHSJgmwrv3eXVm6TGCgJvDzkiGcO0m1o00/FwfjJIS4IHPXADkAHz7QuMp+7W66cE/s5f0+cSVqpxo/ohL6QMAx9Gkz2UMdQTvXEaZCDpAA2IBtg+2iKAxu//pxe4y6cBHIJnas+w7hscjH4WDLbNAjAyDi5ectJwVuPhuGwpZ4v38xlVkB5cvNeD+nONetZ8Yh5JoNT3exHZmVX7GHkYLmaIMFVRea/Z7kIEa1M+Y03vrISMQ9Ud2c/bz6wBHxKe4LfgAf7or5Kax0rvHlugykG5nnuNC3dcVB6v5WwmBdxjfPRZL51OwG55y3/87Ghw8xjw1cn1XGfFf9p5cX3v2iOhQHVtlq5YI49gg4wnkABzuInaXbY0yYHhCQlEYTmb+YeTvtEMYDuYr32MP9DDOXg7GPYqxiQRnA=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1705953937; cv=none; b=l4TsX2zCnvQKqQI6D0MNZk9G49+kUs6qyeY/A8TRU1nMNUvEVstDTb/31ebGO8nXIFltHLO+z/YFGehBmBP9YDv8c44vORnSn27OnRM9i+UNHPvXF+tGzlXNahTerjvdUwFYAO982kWUUv6V8dycElvoBCIJ+rHCag5lPIWEQkKb7NJtmtaS7e9+bkti8flAiuInsrVWjmPQ3mji6ZBt7y9Z3+8zFPhFM3+A1xiXCYKdTn9+KovsNKIwk7LtiVWBCOlUa1ICkhqoVIel+Imc5S+oArMU+xYCDHXbEEta7/Z8KIMvaig45rf5N+xEeSC9mOf+A3k1smwdobg2jhoSzDWqrWOB11Atz2CaRJg0NPKxrtR0cCelmMVyRzB11hwaABzKW1688KccktZ7qpbqBxB5TtNQcTzyXlPPG0NkfIAi1Ly+ga90b6NA5IMMCY/z8aV6hYn7vDP2qLwPWeK/JvS+mEbOschcL5a2zQKOb7AWA7jVuTfIUgT6hokt4e/onTb4HSQhMx6P/qUQhPbjUTA0F6E3G0kO7eLsqICFQentWce25AyTPJQBcw7whVd0RSmg5FV57owjW0rC0LAnmPt49NQdREJXSpnDow6dpHtTF6EBkEnSEOZsYWPYo430Lc1WaW8UMKJYKC2CM7gsmILvOomuEvfukM0oEwHNV2U=
- Authentication-results: smail; arc=none
- Delivery-date: Mon, 22 Jan 2024 21:05:40 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1705953937; bh=7XXJ5TKkHaqDV+greaFlhfneNVHbEvJHhKca0lf0b0o=; h=Date:From:To:Subject:References:In-Reply-To:From; b=Fz+RSpbHB5alo+ftFfedwHzsa3YhdUKTGn+SVTCxWIHCiG2x9lGU6rVQrNF0J9iiT pGZ7wOxnneqVHZCeNvrrwZzIUlR3CEFSydigw68aE4owOuEz8ueFYTBhSTXafvVqc+ Co/ZvmFcAQU9vVnRZO12ybm3olDE6Sg0fhXsRPOhWJEhSm9XwflQgfjN8DLWGqUCh1 p4t8jguW0YPoztVJg4N0Y/64kZNzmLsCCiAxRvy1Jg5Y5V8eJ351+Zjf9U1voogJC2 u3A6OCsXnRMl8ylfwM0/8bQfl7C0FhU512HS2S0O+7Si/bAjfI7xherl/EgcFHadvE PfMNln/SqSXo3XVag9toJFIEdm2MnjeLeRBsViTQS7QUZY9jj5XajW0xx77pmBUsUu DtMKQjppfLfWHc8pGYdMhVe8D5FPTeiNV8hBKJ0yXZPNGXJKgyw2yYtjyQEaqSerTd N0U7LukaoEpSMus5QX4oFFTdmRJtKWtH3C+dBDuAX0OgJ4L9DaeQNrALv5yv6ZLQco DGXgcSl2rAyF1gfrORNHyUzOSHOLHm6KKEy/g50vcHJ6JhK3FYf2M8T6FfMnEzfYkH NDQwnBmtpIiuxsIz6zfONazbhZr6Yvs1T4//c9lEtj0qhiiZyXgrhpXfUZLAOOE+WV f0fZJNc6f1XguasPRQho0u8A=
- In-reply-to: <fd8e11dd-fb0f-4f78-867f-719851302024@isolution.nl>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <b7806246-4381-4aee-8cd6-8fcf0a16e40c@isolution.nl> <ZWeccfBdhkWy3DpL@seventeen> <7137957c-e6e5-48aa-b81d-6d21f49c53f3@isolution.nl> <0bd27b4e-5754-4ce4-943b-607e588990f2@isolution.nl> <001a5277-817e-4c70-8e14-b0bcaffc22e7@isolution.nl> <168b6d04-075b-49c6-b89d-ab3b376fd8b5@isolution.nl> <Za5eAlj9b8CD9bc4@seventeen> <fd8e11dd-fb0f-4f78-867f-719851302024@isolution.nl>
On Mon, Jan 22, 2024 at 02:30:13PM +0100, Ruud H.G. van Tol wrote:
> > safedigits(f)=
> > {
> > my(z=f(),e=exponent(z),k=3,r);
> > while(1,
> > my(K=10^k,y=round(K*z,&r));
> > if (r<0 && (y+1)%K>1, return(y\K));
> > k*=2;
> > localbitprec(e+4*k);z=f());
> > }
> > a(n) = localbitprec(logint(n+2,2)); 1+n+safedigits(()->(n*log(2)/log(3/2)));
>
> To me this is just another example of why to avoid floats and floor() and
> such,
> when the goal is integers.
>
> So I'm back at my original quest. :)
> > ? a054414(n) = 1 + n + floor( n * log(2) / log(3/2) );
> > Is there a cleaner way, similar to logint, to do that floor-expression?
>
> The table() function (from Bill) made me think that a discrete a(n),
> ideally without any slow while-loop, is doable,
> so I will keep looking and trying in that direction.
Well, you can take a middle ground: compute an approximation of the result
using floating point and check and ajust it using exact arithmetic.
Cheers,
Bill.