If $A$ is a square matrix such that $A^{27}=A^{64}=I$ then $A=I$.
What I did is to subtract I from both sides of the equation:
$$A^{27}-I=A^{64}-I=0$$
then:
\begin{align*} A^{27}-I &= (A-I)(A+A^2+A^3+\dots+A^{26})=0\\ A^{64}-I &= (A-I)(A+A^2+A^3+\dots+A^{63})=0. \end{align*}
So from what I understand, either $A=I$ (as needed) or $A+A^2+A^3+\dots+A^{26}=0$ or $A+A^2+A^3+\dots+A^{63}=0$.
At this point I got stuck. By the way, I found out that $A$ is an invertible matrix because if $A^{27}=I$ then also $A^{26}A=AA^{26}=I$ then $A^{26}=A^{-1}$.
Also I thought to use the contradiction proving by assuming that $A+A^2+A^3+\dots+A^{63}=0$, but because $A^{27}=I$, then: $$A+A^2+A^3+\dots+A^{26}+I+A^{28}+\dots+A^{53}+I+A^{55}+\dots+A^{63}=0$$ but yet nothing.
Would appreciate your guidance, thanks!