00:01
So we're asked to compute 7 to 644 mod 645.
00:17
So we're going to use the algorithm modular exponentiation.
00:21
So first let's compute 64 in binary.
00:27
So 644 in binary is.
00:51
And now let's begin the algorithm.
00:54
So first we're going to have two variables, x and power.
01:06
So first we're going to set x equal to 1 and power equal to 7.
01:14
Mod 645, which is just 7.
01:36
So in each iteration of this algorithm, we're going to compute power as 7 raised to the 2j mod 645.
01:58
And here, j just means each digit inside the binary representation of the number 644.
02:06
So these are the j .i.
02:17
And also in each iteration, we're going to multiply the current value of x by 7 raised to 2j mod 645 so x equals x times 7 raised to the 2 j mod 645 so let's start this on right the first iteration we have first iteration we're going to have x equals 1 and power equals 7 squared mod 645 which is just 7 squared or 49.
03:34
In the next iteration, we're going to have x equals 1, and we're going to have power equals 49 squared mod 645.
04:00
This is the same thing as 7 cubed mod 645, and that gives us 240, 2 ,401 mod 645, 2 ,401, mod 645 gives us 466.
04:44
So this is our new power.
04:52
And to make it easy, i'm going to just write working in mod 645.
05:22
This way we don't have to keep writing mod 645.
05:35
Now let's continue.
05:41
Now in the next iteration we have, next iteration we have this number here equals 1.
06:00
So the j -if position equals 1.
06:07
So j2 equals 1.
06:12
So we have x equals 1 times 466 mod 645 which is just equal to 466 666 now power is just 466 squared mod 645 466 squared is 221715 and then mod 645 gives us 436 and then in the next iteration we get we have x equals 466 from before.
07:31
And now power equals 436 from before.
07:40
And we're going to square it mod 645.
07:42
So 436 squared equals and then mod 645 gives us 466.
08:00
We're going to keep going in the next iteration.
08:06
So x is still 466...