Ruud H.G. van Tol on Wed, 24 Jan 2024 17:02:59 +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: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Wed, 24 Jan 2024 17:02:52 +0100
- Delivery-date: Wed, 24 Jan 2024 17:02:59 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1706112176; bh=Gy1QswjlvR+E7gGSGXAbY20SufAVh/Z3GyFOOBvcDOQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=MtfJcVlAlqJL49x9Kf6HDigomqkNJSBpnuAho5uAq3Vc4LhGwZoQPrbJ74gNQzVr/ kbVrNY/+8yCqdPgGQra+Dhw2o0QoNUgvF/vYoOWnamAEoSPruUrK5Y1S6ZAPm6FIJ8 au+E+ZclZPPnSMQBAvHNgNuXTfCsgkHJ5tfoJiptR1nY9rCOH1mcMfqdzlXz3cErQ/ qMRl62nXrODsgxEMolbZ5qpKKm8/yhun3Sv1kg1VgA24alUnDQ6h/wXGT8EQBlBJDX MqBBVZwsG4Zu6Le3T7UbgPucyLFkEEI/VX8OPI6gDmGNllUCmyIrsLJwsmJ61xCJGr kv796hwUBKKEg==
- In-reply-to: <CANXmBjw4+R2ZxA+jh3HABELEc_AUt=PFQP8rE2VMhnsRVVRoyw@mail.gmail.com>
- References: <b7806246-4381-4aee-8cd6-8fcf0a16e40c@isolution.nl> <ZWeccfBdhkWy3DpL@seventeen> <7137957c-e6e5-48aa-b81d-6d21f49c53f3@isolution.nl> <0bd27b4e-5754-4ce4-943b-607e588990f2@isolution.nl> <645e24c6-d580-44e7-8ebe-f3ba4aea69f9@isolution.nl> <CANXmBjw4+R2ZxA+jh3HABELEc_AUt=PFQP8rE2VMhnsRVVRoyw@mail.gmail.com>
On 2024-01-24 15:39, Charles Greathouse wrote:
You can make it faster by storing only the exponent.
first(n)=my(a=-1,b=1,r=-1); vector(n, i, a+=2; b*=3; if(b>>a, , a++;
b*=3; r++); 2*i+r)
On my system this is about twice as fast.
Hello Charles, thanks!
first(2^17);
took 609ms here, and
alist(2^17);
took 1013 ms.
-- Ruud