# Number theory problem - show $N$ is a square when…

I read about this problem back in secondary school and never came close to producing a proof. It has bugged me ever since. I suspect I'm not familiar enough with number theory tricks and so forth to solve it (as well as not being clever enough).

The question is, prove that when N is a whole number it is also a perfect square, where

$$N = 2 + 2\sqrt{12n^2 + 1}$$

so, for example, $N = 16$ when $n = 2$.

Cheers

P.S. this is the first time I have used this site so apologies in advance for defying standard conventions.

• For community reference: the first few values of $n$ for which $N$ is an integer are $2,28,390,5432$. This list is exhaustive up to $10^6$ – Ben Grossmann Aug 6 '13 at 2:12
• @Omnomnomnom, I found those values and also $n=75658$ (hopefully now exhaustive up to $10^6$). – Yoni Rozenshein Aug 6 '13 at 2:13
• @YoniRozenshein Thanks, I just found that after noticing my program had crashed mid-computation. Now that it ran to completion, it seems the list is properly exhaustive. – Ben Grossmann Aug 6 '13 at 2:15
• Observation (no proof, just from the above list): The largest prime factor of $n$ and $\sqrt N$ is the same. For the 5 cases up to $10^6$ this prime is $2, 7, 13, 97, 181$. – Yoni Rozenshein Aug 6 '13 at 2:15
• @YoniRozenshein I added an explanation for your observation, which was interesting. – Calvin Lin Aug 6 '13 at 2:38

Hint: Pell's equation, since $12n^2 + 1 = m^2$ allows you to classify the values.

Sorry but I don't know any other approach, if you are not familiar with this number theory trick.

Observe that in order of $N$ to be an integer, $12n^2 + 1$ must be the square of a rational number. Since it is an integer, hence it must be a perfect square. Thus we have the Pell's equation of the form $m^2 - 12n^2 = 1$.

We can check that $7^2- 12 \times 2^2=1$ is an initial solution. From the theory of Pell's equation, we know that the solutions have the form $$m_i + \sqrt{12} n_i = (7 + 2\sqrt{12})^i = ( 2 + \sqrt{3})^{2i}.$$

Hence,

$$2 + 2 m_i = 2 + (2+\sqrt{3})^{2i} + (2-\sqrt{3})^{2i} = [(2 +\sqrt{3})^i + (2-\sqrt{3})^i]^2.$$

It is now obvious that the expression in the brackets is an integer, hence $2+2m_i$ is a perfect square.

To motivate Yoni's observation that "The largest prime factor of $n$ and $N$ are the same", observe that

$$n_i = \frac{ (2+\sqrt{3})^{2i} - (2-\sqrt{3})^{2i} } {\sqrt{12} } = N_i \frac{ (2+\sqrt{3})^{i} - (2-\sqrt{3})^{i}}{\sqrt{12} }$$

The second term on the right is an integer that is much smaller than $N_i$.

If 12n^2+1 is a square, m^2, then m^2-12n^2=1. This is Pell's equation; looking at the continued fraction expansion of $\sqrt{12}$ shows that 7^2-12*2^2 is the smallest solution. So all values of m, n are given by $m+n\sqrt{12} = (7+2\sqrt{12})^k$ for some positive integer k.