Skip to main content
4 of 4
added 24 characters in body
Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459

This is probably not what you look for, but you may denote $N=\prod p_i$, $m_i=N/p_i$, then consider a polynomial $$q(x)=\prod_i (x^{m_i}+x^{2m_i}+\dots+x^{(p_i-1)m_i}).$$ Your generating function equals $$\frac1{1-x}-\frac{q(x)\pmod {1-x^{N}}}{1-x^{N}}.$$

Or, if you define a fractional part of a rational function $r=f/g$ as $\{r\}=h/g$, where $h=$(remainder of $f$ modulo $g$), the answer may be rewritten as $$\frac1{1-x}-\left\{ \frac{\prod(x^{m_i}-x^N)}{(1-x^N)\prod(1-x^{m_i})} \right\}.$$

Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459