Ruud H.G. van Tol on Sat, 26 Nov 2022 08:48:41 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: 3^k performance
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Sat, 26 Nov 2022 08:47:39 +0100
- Delivery-date: Sat, 26 Nov 2022 08:48:41 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1669448855; bh=JQrImUhd6eFXuo3ywF8PBmOFGoaFm4+f0s/GSbFZybU=; h=Date:To:From:Subject:From; b=KrfAJ+VjySKJ4LWGVssIQr5unI2857AOaIL20LEY7p9Wm9H0LreJonIlpvsEeWcMJ wB+IWlpWBv8Edf9gqziCKEpb2ELW2Bzx+Z/5TizTi+rr4gX8sxxfh4mlxzVkST5+Mz DgCl8twXyOcPi+t22fX5ou2tPggvdqmtv2PDPXcwDV6aZClXIqaF/nurti9XKKAwVJ HYs9LgL3Lr8Dp28ZMCo8DQtwjOtCv+jO6SHfWJKi48p14hdvgHEAQef20mndZpatg3 +0AuX68U9CikZ3VTJ9/gdjmULYR+S7529QitOKpvthmW450bsLIXsu2s+urZxdgm+8 h8y8nr/DWm6QA==
A022330_1(n)=1+n+sum(k=1,n,logint(3^k,2))
A022330_2(n)=my(t=1);1+n+sum(k=1,n,logint(t*=3,2))
? A022330_1(10^5)
cpu time = 8,322 ms, real time = 8,352 ms.
%15 = 7924941755
? A022330_2(10^5)
cpu time = 215 ms, real time = 217 ms.
%16 = 7924941755
So about a 40x difference.
Is that worthwhile to look into?
How to best approach that?
BTW, I learned the trick from
https://oeis.org/A071521
(Charles R Greathouse IV, 2018)
-- Ruud
P.S. And on pari-users I would probably have
also asked which sumnum it should use. :)