Tuesday, 16 October 2018

elementary number theory - Calculate $2^{5104} bmod 10$ using mental arithmetic

I am practising interview for Jane Street's trader internship and I found the following question.




Question: Calculate $2^{5104} \bmod 10$ using mental arithmetic.





I know that $2^5 \bmod 10 \equiv 2 \bmod 10.$
So,
\begin{align*}
2^{5104} & = (2^5)^{1020} 2^4 \\
& \equiv 2^{1020}2^4 \\
& = (2^5)^{204}2^4 \\
& \equiv(2^5)^{40}2^8 \\
& \equiv (2^5)^8 2^8 \\

& \equiv (2^5)^3 2 \\
& \equiv 6 \bmod 10.
\end{align*}



However, I find the calculations above very taxing if I use mental arithmetic. I believe there should be a faster way to answer the question but I am not able to find one.

No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...