Solution
= Solution
By the <Chinese remainder theorem>, $b^{n-1}\equiv1\pmod n$ iff it holds modulo every $p_j$. Since $n-1=p_jr_j-1\equiv r_j-1\pmod{p_j-1}$ and the order of $b$ modulo $p_j$ divides $p_j-1$, this is equivalent to $\operatorname{ord}_{p_j}(b)\mid r_j-1$ for every $j$.