<s>[INST] Finding integer $x$ which its plus one becomes perfect square and its half+1 is also perfect square I am tring to find "integer $x$ which its plus one becomes perfect square and its half+1 is also perfect square". Make this statement into equation I have
\begin{align}
x + 1 = a^2, \qquad \frac{x}{2} + 1 = b^2 
\end{align}
where $x,a,b \in \mathbb{N}$. 
From knowledge of odd perfect square is of the form of $8k+1$. I noticed $x$ should be multiple of 16. 
From trial and errors I found the smallest integer $x$ is $48$.  i.e., 
\begin{align}
48 +1 = 7^2, \qquad 24+1 = 5^2
\end{align}
and the second one is 1680. What is the general form of $x$ and how one can find that? 
 [/INST] We have:
$$2b^2-1=(x+2)-1=x+1=a^2 \implies a^2-2b^2=-1$$
This is a Pell Equation. We can observe that:
$$(a_1^2-2b_1^2)(a_2^2-2b_2^2)=(a_1a_2+2b_1b_2)^2-2(a_1b_2+a_2b_1)^2=A^2-2B^2$$
This means that multiplying values of the form $x^2-2y^2$ will result in values of the same form. It is easy to see that the first solution is $(a,b)=(1,1)$. Now, we can see that since $a^2-2b^2=1$, the expression $$(a^2-2b^2)^{2k-1}=-1$$
will generate solutions when $k \in \mathbb{N}$. For example,
$$k=2 \implies (1^2-2\cdot1^2)^3=(3^2-2\cdot2^2)(1-2\cdot1^2)=7^2-2\cdot5^2=-1$$
This gives the solution $(a,b)=(7,5)$ that you had gotten.
$$k=3 \implies (1^2-2\cdot1^2)^5=(7^2-2\cdot5^2)(3^2-2\cdot2^2)=41^2-2\cdot29^2=-1$$
This gives $(a,b)=(41,29)$ and so on...
</s>