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

Bill Allombert <[email protected]> Fri, 17 Apr 2026 13:29:54 +0200
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <aeIZsvmgIsEAZBMe@seventeen>
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

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;
}

Cheers,
Bill