Ruud H.G. van Tol on Sat, 26 Nov 2022 11:30:08 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: A071521(n)
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Sat, 26 Nov 2022 11:29:03 +0100
- Delivery-date: Sat, 26 Nov 2022 11:30:08 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1669458541; bh=WlKuRMfZfiedyHCUGWrKEUQ696i7EL/B2Jdy6kE4VoM=; h=Date:Subject:From:To:References:In-Reply-To:From; b=PAiUZFy3ub3uNdC78/ufRM61pOBjn/eceiQddps5AvUcDBK8xLUZAEFDInfkXfqWV JMK6y31FwLgIzI1l14CtYP1aeQBjhVjbpNlnPpFhBMhUgvkkW+BiPIRYcCBO/T/1G1 hn8LVRoabXDBYxft9czy/TTkcHAoFCCgkkoYkcSC/a7LV4jHZfW+VSjYKkrzwLsCU1 1CIARLy69ihrHNlHpGQPLcRd8+BnK4GpjQ/nF7Fgw5ys/wrtDK9rwKURuFki/PvykS 2BG4e7ILpCEvNRfEVb/0Zqojo8VuY+wXX+KBpz7Ia08WJkrz4/2GOcw2/fYvfotbJT NcbgpfqitwF8A==
- In-reply-to: <cb566377-20f1-1d17-4350-a314d47dba6e@isolution.nl>
- References: <cb566377-20f1-1d17-4350-a314d47dba6e@isolution.nl>
"A071521 Number of 3-smooth numbers <= n"
https://oeis.org/A071521
The (to me very educational) PARI-code
from Charles, on that page, looks to me
like a variant of a formula shown in
the "Raphael Schumacher" link.
I would now probably write it as:
A071521(n)= my(t=1);sum(k=1,logint(n,3),logint(n\t*=3,2)+1)
(just trying to shave off another millisecond,
though I was blown away by its speed already:
a 3^k variant takes 40x as long)
-- Ruud
P.S. As n could be any ridiculous integer,
a "powers()" approach isn't applicable.
A "Power(b,e)=exp(e*log(b))" approach might be feasible,
but that probably just takes longer,
and will add precision treats.