If a prime $p$ divides $n^2$ then it also divides $n$ - Is this proof correct? I'm learning Real Analysis by myself and I wanted to prove that if a prime $p$ divides $n^2$ where $n$ is an integer, then $p$ divides $n$ itself. I saw that proving this is the same as saying that the prime factors of $n^2$ are "the same" than those of $n$.
In this case, assume there exists a prime factor $a_q$ in $n^2$ which is not in $n$ (proof by contradiction). By Fundamental Theorem of Arithmetic, we can represent $n^2$ as $n^2= a_1 * a_2 * ... * a_x * a_q$, where every $a$ is prime and $n=k_1 * k_2 * ... * k_y$ (every $k$ is also prime). We know that $\frac{n^2}{n}=n$. So (by susbstituting):
$\frac{n^2}{n}= \frac{a_1*...*a_x*a_q}{k_1*...*k_y}=n \rightarrow \frac{a_1*...*a_x}{k_1*...*k_y}=\frac{n}{a_q}$
Because $\frac{n}{a_q}$ it's not an integer (initial statement), there's at least one $a_s$ in the left side of the equation that is not divisible by any $k$. Now we have two factors of $n^2$ that don't divide $n$. We can repeat this process, 
$\frac{a_1*...*a_x*a_s}{k_1*...*k_y}=\frac{n}{a_q} \rightarrow \frac{a_1*...*a_x}{k_1*...*k_y}=\frac{n}{a_q*a_s}$,
for each prime factor of $n^2$ which means that there's no factor $a_i$ in $n^2$ divisible by any factor $k_j$ of $n$. But we knew that $\frac{n^2}{n}=n$, hence we have a contradiction ($n^2$ is not divisible by $n$). So there's no prime factor $p$ in $n^2$ that does not divide $n$ itself $\rightarrow$ every prime factor $p$ in $n^2$ also divides $n$.   
I'm obviously not an expert in demonstrations so I want to know if this is a valid argument. I'm also aware of Euclid's Lemma, but for this case, ignore it. 
 A: A shorter way would be to write $n=p_1^{\alpha_1}\cdots p_k^{\alpha_k}$ (where each $\alpha_i>0$) by the Fundamental Theorem of Arithmetic. Then $n^2= p_1^{2\alpha_1}\cdots p_k^{2\alpha_k}$. The only primes that divide $n^2$ are $p_1,\cdots,p_k$ and these clearly also divide $n$. 
A: Here is a different approach. Unique prime factorization of $n,$ for $1<n\in \Bbb N,$ follows from the Lemma that if $a,b,c\in \Bbb Z$ and $\frac {ab}{c}\in \Bbb Z$ while $\gcd (a,c)=1$ then $\frac {b}{c}\in \Bbb Z.$ The Lemma follows from something called Bezout's Identity, although it is implicit in Euclid's algorithm for computing a $\gcd$ : For any  $a,b\in \Bbb Z$ (not both $0$) there exist $x,y \in \Bbb Z$ such that $ax+by=\gcd (a,b).$
Let $p$ be prime and let  $n\in \Bbb Z$ such that $p|n^2.$ Let $m=\gcd (p,n).$ Since $m$ divides the prime $p$ and $m\ge 1,$ we have $m=1$ or $m=p.$
Now there exist $x,y\in \Bbb Z$ such that $px+ny=m,$ so $\frac {(m-px)^2}{p}=\frac {n^2y^2}{p}=\frac {n^2}{p}\cdot y^2\in \Bbb Z.$ But if $m=1$ then $\frac {(m-px)^2}{p}=\frac {1-2px+p^2x^2}{p}=\frac {1}{p}-2x+px^2\in \Bbb Z,$ implying $\frac {1}{p}\in \Bbb  Z,$ which is absurd.
So, since we can't have $m=1,$ we have $m=p$. And since $m=\gcd (p,n)|n,$ we have  therefore $p|n.$ 
