ArcanaNoir
- 778
- 4
Homework Statement
Calculate 2^{644} mod 645.
Homework Equations
I think I should use repeated squaring, but I'm open to other techniques.
The Attempt at a Solution
I start out fine,
2=2 \\<br /> 2^2=4\\<br /> 2^4= 16\\<br /> 2^8=256\\<br /> 2^{16}=65536\equiv 391
But that's where it starts to break down. I don't think I understand the point of repeated squaring. I mean yes I know I am looking for 256+256+128+4 =644 but that requires calculating 2^256 mod 645, which is still stupidly difficult as far as I can tell, or is there something I'm missing?