Consider the set $A=\{\sqrt{2017+n^2}:n\in N\}$. How many numbers in the set A are rational?
My attempt:
The square-root of a non-negative integer can either be a rational number or an irrational number. When it is a rational number it has to be an integer. It cannot be anything else (I do not exactly know why but my mind says so).
So by this logic, if $\sqrt{2017+n^2},n\in N$ is a rational number , it has to be a positive integer. Therefore, $2017+n^2=k^2$, for some $k\in N$. Therefore, $2017=(k+n)(k-n)$. Since $k,n\in N$, and $2017$ is a prime number, $(k+n)=2017,(k-n)=1$. This implies, $k=1009, n=1008$. Since we got one value of $n$, there is only one number is $A$ which is rational.
Is my reasoning and my answer right? If not then what is the correct reasoning and answer and if yes then what is the justification of the line in bold?
For this, you can use the Rational Root Theorem
Consider the polynomial $x^2 - (n^2+2017)$ whose roots yield what you want. Here, $a_0 = n^2+2017$ and $a_n=1$. The theorem states that any rational root $x = \large{\frac{p}{q}}$ (in its lowest terms, i.e., $gcd(p, q) = 1$), will be such that $p\ |\ a_0$ and $q\ |\ a_n$.
Here since $a_n=1$, it clearly means $q=1$ and all hence $x \in \mathbb Z$