It is a well known property that: **order of group = order of generator of that group.**

This means Order(a)=10, ===> $a^{10}$=e.

Let Order($a^{8}$) = x,

∴ $(a^{8})^x$ = e ===> $a^{8x}$ = e ------------ (1)

we know that, e$^i$ = e ( for some i > 0 ), therefore we can substitute this property in (1)

∴ $a^{8x}$ = (e)$^i$ ==> $a^{8x}$ = $(a^{10})^i$

∴ 8x = 10 i

You can easily guess that, smallest possible value which can satisfy it is x = 5 for i = 4.

∴ Order($a^{8}$) = x = 5

Now my problem is " we should have to guess ? "

8x = 10 . i

2$^3$ x = 2$^1$.5$^1$.i ( just represent every number into product of prime numbers. )

cancel the common terms, ( indirectly canceling the GCD of 8,10 )

2$^2$ x = 5$^1$.i

as we require minimum value in i, which can equate it !

just substitute i=2$^2$, then the eqn should be like 2$^2$ x = 5$^1$.2$^2$ ==> x = 5.

How the formula, which is mentioned by lakshman is derived ?

k x = n i, then what we did ?

represent in prime form and cancel the GCD in both side and remaining part of coefficient of x is assigning to i.

let gcd of (k,n) = p

then k = K$_1$.p and n = K$_2$.p

k x = n i

K$_1$.p x = K$_2$.p.i ==> K$_1$ x = K$_2$ . i, then keeping i = K$_1$, x = K$_2$,

x = K$_2$

x = K$_2$ . $\frac{p}{p} = \frac{K_2.p}{p} = \frac{n}{p} = \frac{n}{gcd(n,k)} $