Problem 120 - square remainders

 - r is cyclical as n increases, so check values of n until cycle detected
 - use modulo arithmetic to prevent overflow
 - use results of r(a, n-1) to compute r(a, n)