The two are identical. Unless I missed something, dividing by a product is the same as dividing by each of the factors. Mathematically:

**Code:**

a / b / c = (a / b) / c = (a / b) * (1 / c) = (a * 1) / (b * c)

That doesn't hold with integer division in C, yes, because of the round-off error introduced in step 2, but the ends still apply. I am sure, someone better versed in number theory than I could prove this proposition. But for now I have simply written a program to prove it for me within the range given and it failed to find any counter examples. And that is good enough for me.

pretzelpirate wrote:

I don't have permissions to edit the Wiki yet, but if this looks correct, I can add the reference.

Enter your user control panel, click "user groups", click "Wiki", and click "Join". Done.