Last digit of a number $x^m$ 
Let $n$ be an integer that is not divisible by any square greater than $1$. Denote by $x_m$ the last digit of the number $x^m$ in the number system with base $n$. Prove that the sequence $x_m$ is periodic with period $t$ independent of $x$.

Attempt:
To prove that $x_m$ is periodic with period $t$ independent of $x$, we see that it is sufficient to find the residues modulo every prime factor of $n = a_1 a_2 a_3 \cdots$ where $a_1,a_2,\ldots$ are the prime factors of $n$ listed in ascending order. Then using Fermat's Little Theorem, $x^{a_i}\equiv x \pmod{a_i}$ and thus the periods of each of the modular congruences modulo $a_i$ is $a_i-1$. Thus, the period $t = \text{lcm}(a_1-1,a_2-1,\ldots)$.
I am conjecturing the last result I have, which is that $t = \text{lcm}(a_1-1,a_2-1,\ldots)$, but is there a way to justify it?
Edit: Here is the original question.

 A: Your conjecture is correct, provided that you speak of a period throughout, not of the period, meaning the shortest period. So you have a period $a_i-1$ of each modular congruence modulo $a_i$. Setting $t = \mathrm{lcm}(a_1\!-\!1,\,a_2\!-\!1,\,\ldots)$, the residues of $x^m$ will be the same as the residues of $x^{m+t}$, modulo each prime $a_i$, thus also the residues of $x^m$ and $x^{m+t}$ modulo $n$ will be the same. This means that $t$ is a period of the sequence $(x_m)$.
Added a little later. $~$When I posted the answer above, I have noticed the first two comments to the question. The confusion in both comments is caused by thinking of the period when what we are dealing with is a period.
Added still later. $~$The answer to the question by "user19405892" in his comment:

Another part of the question was
"Prove that if $m$ and $n$
  are relatively prime, then $0_m$, $1_m$, $\ldots$, $(n−1)_m$
  are different numbers."
This doesn't really make sense to me.

Actually, what "user19405892" really quoted was "If $m$ and $x$ are relatively prime$\ldots$", which does not makes sense to me, either. If this is the actual formulation, then "$x$" is a typo, it should be "$n$", as above: the numbers in the sequence  $0$, $1$, $\ldots$, $n-1$ are the $x$-es. But even in this form the statement is false: for $n=5$ and $m=2$ the sequence $(0_2,1_2,2_2,3_2,4_2)$ is $(0,1,4,4,1)$, which is not a permutation of $(0,1,2,3,4)$. It would be futile to agonize about what the right question should be; it appears that the author of the original question, the one which "user19405892" was supposed to answer, did not think things through. --- Cannot hold this back, though: if $n$ is a prime and $m$ is coprime to $n-1$ (note: $m$ coprime to $n-1$, not to $n$), then $0_m$, $1_m$, $\ldots$, $(n−1)_m$
are different numbers. "user19405892": work this out on your own.
A: Choose an $x$.  Let $\gcd(x,n) = d$.  Let $x = dx'$ and $n = dn'$. $\gcd(x',n) = \gcd(x, n') = \gcd(x',n') =1$.  And as $n$ is square free $\gcd(n',d) = 1$. 
By FLT $x^{\phi(n)} = d^{\phi(n)}x'^{\phi(n)} \equiv d^{\phi(n)} \mod n$.
But $d^{\phi(n)}\equiv 1 \mod n'$ so $d^{\phi(n)} \equiv 1 + kn' \mod n$ so $d^{\phi(n)+1} \equiv d + kn'd \mod n \equiv d \mod n$.
So $x^{\phi(n)+1} =d^{\phi(n)+1}x'^{\phi(n) + 1}\equiv dx' \mod n \equiv x \mod n$ 
IF $n$ is square free.  
So every $\{x_m\}$ has a period of $\phi(n)$ which is independent of $x$.
