Han Xin's troop counting is a classic problem in ancient Chinese mathematics, also known as the Chinese Remainder Theorem. Legend has it that when Han Xin was counting troops, he had soldiers line up in different numbers and calculated the total by observing the remainders.
The first condition: when soldiers line up in groups of 3, there are 2 remaining. We express this mathematically as N congruent to 2 modulo 3. This means when the total number is divided by 3, the remainder is 2.
The second condition: when soldiers line up in groups of 5, there are 3 remaining. We express this as N congruent to 3 modulo 5. This means when the total number is divided by 5, the remainder is 3.
The third condition: when soldiers line up in groups of 7, there are 2 remaining. We express this as N congruent to 2 modulo 7. Now we have a system of three congruences that we need to solve simultaneously.