Ruud H.G. van Tol on Sat, 18 Apr 2026 13:20:21 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: numbpart(k, {a = k})



On 2026-04-18 12:18, Bill Allombert wrote:
> On Fri, Apr 17, 2026 at 04:50:05PM +0200, Ruud H.G. van Tol wrote:
>> On 2026-04-17 12:03, Bill Allombert wrote:
>>> On Fri, Apr 17, 2026 at 08:55:23AM +0200, Ruud H.G. van Tol wrote:

>>>> Would a variant numbpart(k, {a = k}) be interesting, like Maple has?
>>>> With the optional a-parameter like with partitions(k, {a = k}, {n = k}). >>> numbpart use Rademacher formula, which is much faster than #partitions(n) but is
>>> only valid for partitions(n,,).
>>> I do not know fast formula for the other cases.
>>>
>>> For example pari can compute numbpart(1000000) in 5 ms
>>
>> I presumed that it would become an additional GEN numbpart_GG(GEN k, GEN a).
>
> You can write it in GP in one line:
>
> nbpart(k,a=k,n=k)=my(s=0);forpart(x=k,s++,a,n);s;

Sure, but that wouldn't tickle my performance bone.

I want to dig into it some more, soon, but am not in a hurry.

-- Ruud