Determining the general form of $10^x \bmod 210$ While solving a problem I came across solving $10^x\bmod 210$ for various values of $x$. It seems that the values repeat after an interval of 6 for $x\geq4$. Can any one explain how can solve this equation for some value of $x$ and show that it repeats at an interval of 6.
Note that $210 = 2\times3\times5\times7$ is a product of the first four primes.
Thanks
 A: $10^x \equiv 0 \mod 2$ and $\mod 5$ for $x \ge 1$.
$10 \equiv 1 \mod 3$ so $10^x \equiv 1 \mod 3$ for all $x \ge 0$.
$10 \equiv 3 \mod 7$ and $3^6 \equiv 1 \mod 7$ so $10^{6k} \equiv 1 \mod 7$ for all $k$.  Moreover since $3^2$ and $3^3$ don't work, $10^x \equiv 1 \mod 7$ only for multiples of $6$.  If $x, y \ge 1$ and $x = y + 6 k$,
$10^x - 10^y = 10^y (10^{6k} - 1) \equiv 0 \mod 2, 5, 3$ and $7$, and therefore $\mod 210$. 
A: This is the overarching theory behind what's going on. When you get your hands dirty with more details and actual numbers you can compute discrete logarithms "locally" by this reasoning.

The content of Sun-Ze (aka Chinese Remainder Theorem) is the ring isomorphism
$$\frac{\Bbb Z}{p_1^{e_1}\cdots p_r^{e_r}}\cong\frac{\Bbb Z}{p_1^{e_1}}\times\cdots\times\frac{\Bbb Z}{p_r^{e_r}}$$
given rather cleanly by $x\bmod n\mapsto (x\bmod p_1^{e_1},\,\cdots,\,x\bmod p_r^{e_r})$. Recall that the set of units (that is, invertible elements) mod $n$ form a finite group, so any unit under repeated powers forms a finite cyclic group and thus when written down in a sequence will be periodic.
Suppose $x=p_1^{f_1}\cdots p_r^{f_r}\times{\cal O}$ (where $\cal O$ stands for "outside factors"); no assumptions made on $f_i$s, so they can be zero or positive, bigger or smaller or equal to $e_i$s, etc. Then we have
$$x\mapsto (p_1^{f_1}\times{\cal O}_1\bmod p_1^{e_1},~\cdots,~ p_r^{f_r}\times{\cal O}_r\bmod p_r^{e_r}) $$
under our isomorphism, in which the ${\cal O}_i$s are all units in their respective coordinates. (In particular they are defined by ${\cal O}_i={\cal O}\times\prod_{j\ne i}p_j^{f_j}$.)
In each coordinate, powers will follow one of two trajectories: if $f_i>0$ then eventually the power of $p$ present will exceed $e_i$ in which case we have hit zero (the number of steps being $\lceil e_i/f_i\rceil$); if instead $f_i=0$ then our $i$th coordinate is a unit which will just cycle.
Thus once we have gone far enough to make all the nonunit coordinates hit zero, the remaining terms will cycle with a period which is a multiple of all of the components' periods (the lcm to be precise). Before this though the nonunit coordinates have nonzero values, values they will never obtain again, so ultimately there is a "rho" trajectory: the sequence of powers will start off on a path and then in finite time lock into a circle (like writing out the Greek letter $\rho$).
A: In general, when you find the first instance of a repeated value in an exponential modulus formula like this, like $10^{k+6} = 10^k \hbox{ mod } 210$ for some $k$, then the values will always repeat from then on with the same period (6 in this case), i.e. 
$$10^{k + n} = 10^{k + (n \, \hbox{mod} \, 6)} \, \hbox{ mod } \, 210$$ 
if the repetition starts with $10^{k+6} = 10^k$ for some $k$, and so if you know the first values of $10^x \hbox{ mod } 210$ for $x =0,1,2,\ldots,k+5$ then you can solve for any $n$ with the above formula.
More generally, if you want to quickly know what is the first $k$ and the smallest period $p$ that will produce $a^k = a^{k+p} \hbox{ mod } N$ for given $a,N$, then you need to find the factorizations of $a$ and $N$.  $k$ will be the first $k$ such that the common prime factors of $a$ and $N$ each have at least as high of an exponent in $a^k$ as they do in $N$.  The period $p$ can be found by considering the prime factors of $N$ that are not factors of $a$.  For each of these prime factors $q$, if $q^j$ is the largest power that divides $N$, then you need to find the smallest positive exponent $p_q$ that solves $a^{p_q} = 1 \hbox{ mod } q^j$.  Then the overall period $p$ will be the least common multiple of all the $p_q$.
A: Using Carmitcheal function, $\lambda(21)=$lcm$(\lambda(3),\lambda(7))=$lcm$(2,6)=6$
and  $(10,21)=1,10^6\equiv1\pmod{21}$
$10^0\equiv1\pmod{210}$
As $a\equiv b\pmod m\implies a\cdot k\equiv b\cdot k\pmod{m\cdot k} $
$10^0\equiv1\pmod{21}\implies 10\equiv10\pmod{210}$
$10^1\equiv10\pmod{21}\implies 10^2\equiv100\pmod{210}$
$\displaystyle 10^2\equiv-5\implies 10^3\equiv-50\pmod{210}\equiv160$
$\displaystyle 10^3=10\cdot10^2\equiv10(-5)\equiv-8\implies 10^4\equiv-80\pmod{210}\equiv130$
$\displaystyle 10^4=(10^2)^2\equiv(-5)^2\equiv4\implies 10^5\equiv40\pmod{210}$
$\displaystyle 10^5=10\cdot10^4\equiv10\cdot4\equiv-2\implies 10^6\equiv-20\pmod{210}\equiv190$
$\displaystyle 10^6\equiv1\pmod{21}\implies 10^7\equiv10\pmod{210}$
So, for $10'$s power$(>0)$  the cycle is $\cdots,10,100,160,130,40,190,\cdots$
