1Some calculators, such as the HP, series have modulo arithmetic function that can handle this calculation.