Re: numbpart(n, {a = k})
"Ruud H.G. van Tol" <[email protected]> Fri, 17 Apr 2026 15:14:43 +0200
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <[email protected]> |
On 2026-04-17 13:29, Bill Allombert wrote:
> On Fri, Apr 17, 2026 at 12:03:17PM +0200, Bill Allombert wrote:
>> Yes. There is a formula which is missing from the OEIS, you should probably add it:
>> The generating series is
> I meant
>
> (Phi(-x)/Phi(x^2) + 1/Phi(x))/2
>
>> where Phi is the Euler function mentionned in https://en.wikipedia.org/wiki/Dedekind_eta_function
>> which admits a lacunary series and can be computed in GP using eta().
>>
>> So the formula in GP is simply:
>>
>> first2(nn) = Vec(eta(-x+O(x^nn))/eta(x^2+O(x^nn)) + 1/eta(x+O(x^(nn))))/2
Test:
? #first2(10001)
# 10001
> One can do a bit better:
>
> first3(nn) =
> {
> my(E = eta(x+O(x^(nn))), Ei=1/E);
> Vec(subst(E,x,-x)*subst(Ei+O(x^(nn\2)),x,x^2) + Ei)/2;
> }
Test:
? #first3(10001)
# 10000
first4(nn) = {
my(E = eta(x+O(x^(nn))), Ei = 1/E);
Vec( subst(E, x, -x) * subst( Ei + O(x^( nn\2 + 1 )), x, x^2) + Ei)/2;
}
Test:
? first2(10001) == first4(10001)
# 1
That is just great, thanks!
-- Ruud