Use the product to sum formula on the RHS,

Factor the LHS,

So LHS=RHS if which happens iff where .

Now assume . Then we can divide it from both sides, and expand the RHS to get

Similarly, this has solutions where and .

Summing up all the solutions, we have