Direct proof that if p is prime, then $\sqrt{p}$ is irrational. [closed]

Does anyone know of a simple direct proof that if p is prime, then $\sqrt{p}$ is irrational?

I have always seen this proved by contradiction and have been trying unsuccessfully to prove it constructively. I searched this site and could not find the question answered without using contradiction.

closed as off-topic by user223391, Davide Giraudo, user26857, 6005, KittyLDec 30 '15 at 23:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Community, Davide Giraudo, user26857
If this question can be reworded to fit the rules in the help center, please edit the question.

• Since the definition of irrational is not rational, most proofs of irrationality are contradictions. – Michael Burr Dec 30 '15 at 22:48
• Tim Gowers has some discussion here about how any such proof really must be by contradiction. – Casteels Dec 30 '15 at 22:50
• Possible duplicate of Proving that for each prime number $p$, the number $\sqrt{p}$ is irrational – 6005 Dec 30 '15 at 23:18
• OP--proofs not necessarly by contradiction can be found here, which the duplicate was closed as a duplicate of. – 6005 Dec 31 '15 at 22:39

Maybe an elementary proof that I gave in a more general context, but I can't find it on the site, so I'll adapt it to this case.

Set $n=\lfloor \sqrt p\rfloor$. Suppose $\sqrt p$ is rational and let $m$ be the smallest positive integer such that $m\sqrt p$ is an integer. Consider $m'=m(\sqrt p-n)$; it is an integer, and $$m'\sqrt p=m(\sqrt p-n)\sqrt p=mp-nm\sqrt p$$ is an integer too.

However, since $0\le \sqrt p-n <1$, we have $0\le m' <m$. Since $m$ is the smallest positive integer such that $m\sqrt p$ is an integer, it implies $m'=0$, which means $\sqrt p=n$, hence $p=n^2$, which contradicts $p$ being prime.

You could first prove that all square numbers have a prime decomposition with all primes of even powers.

For example if $k$ is square, and,

$k=\prod_{k=1}^{n}p_{k}^{e_{k}}$,

then each of $e_{k}$ must necessarily be even.

From there it is enough to show that primes have an odd power (namely 1) in their decomposition.

For specific primes you can prove $x^2-p$ is irreducible over the rationals by proving it is irreducible modulo some other prime $q$. This means that $\sqrt{p}$ cannot be rational. This can probably be done in general using quadratic reciprocity.

If you have the Rational Root Theorem available to you (https://en.wikipedia.org/wiki/Rational_root_theorem) you can apply it to $x^2-p$.