# Using semiproduct to construct a non-abelian group.

I want to construct a non-abelian group of order $pq$ which is a semidirect product of two cyclic groups of orders $p$ and $q$ with $p|q-1$.

For example, consider the cyclic groups $C_3=\langle a\rangle$ and $C_7=\langle b \rangle$, we have $3\cdot 2=7-1$. We want to construct a non-abelian group of order 21. Consider the mapping $f: C_7\to C_7, f(b^i)=b^{2i}$, it is clearly an automorphism, since 2 and 7 are coprime. The order of this automorphism is 3: $$f^3(b^i)=b^{8i}=b^i$$ Therefore, the mapping $\phi: C_3\to \operatorname{Aut}(C_7), \phi(a^i)=f^i$ is a homomorphism, and we can form a semidirect product $C_3\ltimes_\phi C_7$.

I want to generalise this construction. Suppose $|\langle a\rangle|=p, |\langle b\rangle|=q$ and $pn=q-1$. Consider the mapping $f: \langle b\rangle\to \langle b\rangle, f(b^i)=b^{ni}$, this is an automorphism. Is its order going to be $p$? $$f^p(b^i)=b^{n^pi}$$ or am I constructing the wrong automorphism here? I think I either need to construct an automorphism or use some other statement from group theory which guarantees that $\operatorname{Aut}(\langle b\rangle)$ has a subgroup of order $n$.

$*$ Corrections
$\langle a \rangle$ is a cyclic group for every element $a$ of a group. $|\langle a \rangle|$ divides the order of the group, by Lagrange's theorem. Raising every element of an abelian group* to the same power is an endomorphism, the Frobenius endomorphism. If every element's order is coprime to the power used, the Frobenius endomorphism is an automorphism.
If the power is coprime to the order of the group, then it's coprime to every proper factor of the group's order as well - if $p \mid q, p \nmid (q-1)$, in this case. Thus, every cyclic group of order $n$ admits a homomorphism to the automorphism group of every abelian group* of order $nk+1$. Hence one can construct a semidirect product of the two.
Observe that the semidirect product's underlying set is the cartesian product of the two groups. It is therefore of order $n(nk+1)$, as required.