In my number theory textbook I am tasked with finding the value of $5^{30}\mod 62$. As the last section had been about Eulers Theorem which states that for any $a,n\in\mathbb{Z}$ where the $\gcd(a,n)=1$ $$a^{\phi(n)}\equiv1\mod n$$ The first thing I check was therefore what $\phi(62)$ is, and as $\phi(62)=30$ and $\gcd(5,62)=1$, I got the result $$5^{30}\equiv1\mod 62$$ However when I double checked my anwser with MatLab I recived the anwser
>>mod(5^(30),62) = 44
And now I don't whats wrong, is this an error with my MatLab code or an error with my Number Theory?
powermod(a,b,m)for $a^b \mod m$ https://uk.mathworks.com/help/symbolic/sym.powermod.html – Matthew Towers Nov 06 '24 at 19:21R = IntegerModRing(62); R(5^30)on Sage indeed returns1. – SchellerSchatten Nov 06 '24 at 19:24