In fact, we can be a bit more general than this. For example, it is sufficient for p1, p2, ...and pn to be pairwise coprime (no two have a common factor greater than 1) rather than just prime, and the proof proceeds in the same way.
You might like to look at two related problems on the NRICH site: Remainders and One O Five .