Cyclic group and prime divisors of its order I am trying to make a proof of the following statement, but I am stuck in showing the second of the two directions.

Given is a cyclic group $G$. Let $P=\left \{ p_{1},...,p_{n} \right \}$ be the set of all prime divisors of the group order $\left | G \right |$. Prove that $g$ is a generator of $G$ if and only if $g^{\left | G \right |/p_{i}}\neq 1$ for all $i\in \left \{ 1,...,n \right \}$.

My approach for the one direction "$\Rightarrow$" Let $g$ be a generator of the cyclic group $G$. We know from Langrange theorem(right?) that $g^{\left | G \right |}=1$. From $p_i$ a prime divisor of the order of the group, it follows that $\left | G \right |/p_{i}$ will be equal to another prime divisor $p_{j}$, which is an element of the set $P$, or a product of prime divisors. Anyway, $\left | G \right |/p_{i}$ will be strictly smaller than $\left | G \right |$, so $g^{\left | G \right |/p_{i}}$ cannot be equal to the identity $1$.
Is this a correct idea?
Can anyone help me with the proof of the other direction of this problem, please? This means we assume that $g^{\left | G \right |/p_{i}}\neq 1$ and we have to show that $g$ generates $G$. 
Thank you in advance!

Assume $g$ is not a generator.  Then $\alpha:=\text{ord}(g)<|G|$.  By Lagrange's Theorem, $\alpha|\left(|G|\right)$, so there exists $k\in \Bbb N$ such that $k\alpha=|G|$. Let $p|k$ and $p$ be prime, and let $\ell$ such that $p\ell=k$.  Then $\ell\alpha=\frac{|G|}{p}$, and $g^{\frac{|G|}{p}}=g^{\alpha\ell}=(g^\alpha)^\ell=e^\ell=e$.  By the contrapositive, if $g^{\frac{|G|}{p}}\ne e$ for all prime $p|(|G|)$, then $g$ is a generator.
Note: all cyclic groups $G$ are isomorphic to $\Bbb Z/(|G|)\Bbb Z$, so a simpler way to put this might be: prove $\gcd(|G|,g)=1\iff |G|\not|\ \left(g\frac{|G|}{p}\right)$ for all prime $p|(|G|)$.  This also gives a bit of intuition.
