Is $\sqrt{m}$ irrational iff at least one prime occurs with an odd exponent in the factorisation of $m$? Thinking about it, I think I found the following criterion for irrationality of $\sqrt{m}$ if $m$ is a positive integer.

Let $p_1^{a_1}\cdots p_k^{a_k}$ be the prime factorization of $m$. Then $\sqrt{m}$ is irrational if and only if $a_i$ is odd for at least one $1\le i\le k$.

Anyone knows if this is correct and, if so, a proof thereof?

This is correct. Since for any $p_i$ with power $a_i\geq 2$ you can put all except perhaps one outside the square root, it's enough to consider numbers where each prime factor has power $1$ (the so-called square free numbers). Thee question then translates to "The only square free number that has a rational square root is $1$" (I don't really know if $1$ is considered a square free number).
A variant on the proof of the irrationality of $\sqrt2$ works fine.
