Help with repeated squaring

124 Views Asked by At

I'm having trouble figuring out how to use repeated squaring to figure out 289^377 mod 589.

I've seen other websites break the exponent down into (1 + 4 + 16 ... ), but I'm not sure when to do that.