Get the last two digits of $16^{100}$ and $17^{100}$

I try to get the last two digits of $16^{100}$ and $17^{100}$

I started with:

$6^{1} = 6$

$6^{2} = 36$

$6^{3} = 216$ means last digit for $6$ is always $6$

That is why the last digit for $16^{100}$ is $6$

And for $17^{100}$ i calculated:

$7^{1} = 7$

$7^{2} = 49$

$7^{3} = 343$

$7^{4} = 2401$

$7^{5} = 16807$

And because $4*25 = 100$ or better said $100mod4 = 0$

The last digit for $17^{100}$ is $1$

But how do i get the penultimate digits? Thanks


As $(17,100)=1,$ and using Carmichael function $\displaystyle\lambda(100)=20$

$\displaystyle\implies17^{20}\equiv1\pmod{100}$


$16^{100}=(2^4)^{100}=2^{400}$

As $(2^{400},100)=4=2^2\ne1$ let us find $2^{400-2}\pmod{25}$

As $\displaystyle\lambda(25)=\phi(25)=20, 2^{20}\equiv1\pmod{25}$

and $\displaystyle400-2\equiv18\pmod{20}\implies 2^{400-2}\equiv2^{18}\pmod{25}$

Now, $\displaystyle2^9=512\equiv12\pmod{25}\implies 2^{18}=(2^9)^2\equiv12^2=144\equiv19\pmod{25}$

$\displaystyle\implies 2^{400-2}\equiv19\pmod{25}\ \ \ \ (1)$

Now as $\displaystyle a\equiv b\pmod m\implies a\cdot n\equiv b\cdot n\pmod{m\cdot n}$ for any integer $n,$

multiply either sides of $(1)$ by $4$


Another way for $16$

We have already found $\displaystyle16^{100}=2^{400}$

$\displaystyle2^{10}=1024\equiv24\pmod{100}\implies 2^{20}\equiv24^2=576\equiv76$

Now, $\displaystyle2^{20a+b}-2^b=2^b(2^{20a}-1)\equiv0\pmod{100}$

if $4$ divides $2^b\iff$ integer $b\ge2$

and $2^{20a}-1$ is divisible by $2^{20}-1$ for any positive integer $a$ and $2^{20}\equiv1\pmod{25}$ by the other answer

So, $\displaystyle2^{20a+b}\equiv2^b\pmod{100}$ if integer $b\ge2,a\ge1$

Setting $\displaystyle b=20\implies2^{20(a+1)}\equiv2^{20}\pmod{100}\equiv76$

Now, set $a+1=20$