If 4n+1 and 3n+1 are both perfect sqares, then 56|n. How can I prove this? Prove that if $n$ is a natural number and $(3n+1)$ &amp; $(4n+1)$ are both perfect squares, then $56$ will divide $n$.


Clearly we have to show that $7$ and $8$ both will divide $n$.

I considered first $3n+1=a^2$ and $4n+1=b^2$. $4n+1$ is a odd perfect square.
 - so we have $4n+1\equiv 1\pmod{8}$; from this $2|n$ so $3n+1$ is a odd perfect square.
 - so $3n+1\equiv 1\pmod{8}$ so $8|n$ but I can't show $7|n$. How do I show this?

Thanks for the help.
$3n+1=a^2$ and $4n+1=b^2$ gives $4a^2-3b^2=1$. With $x=2a$ and $y=b$ we get an instance of Pell's equation.

$$x^2-3y^2=1.$$

Trying small integers, it is obvious that the minimal solution is $4-3=1$, that is $x_1=2$ and $y_1=1$.

Therefore, all the solutions are of the form $(x_k,y_k)$ with $x_k+y_k\sqrt 3=(x_1+y_1\sqrt 3)^k$ or equivalently
$$ \begin{align}
x_{k+1}&amp;=2x_k+3y_k\\
y_{k+1}&amp;=x_k+2y_k,
\end{align} $$
(which already works starting from the trivial solution $x_0=1$, $y_0=0$).

This gives $3y_{k+1} =3x_k+6y_k$ which implies $$\begin{align}&amp;x_{k+2}-2x_{k+1}=3x_k+2x_{k+1}-4x_k\\
\Leftrightarrow &amp;x_{k+2}-4x_{k+1}+x_k=0
\end{align}$$
and $x_0=1$, $x_1=2$.

Clearly, the $x_i$ alternate in sign and we are only interested in the even ones which are those with odd index.
$$\begin{align}x_{2k+1} &amp;= 4x_{2k}-x_{2k-1}\\&amp;=4(4x_{2k-1}-x_{2k-2})-x_{2k-1}\\ &amp;=15x_{2k-1}-x_{2k-1}-x_{2k-3}\\&amp;=14x_{2k-1}-x_{2k-3}.\end{align}$$

Upon division by two, we obtain the recurrence for the solutions $a_k$ to $3n+1=a^2$ subject to the other condition.

$$a_k=14a_{k-1}-a_{k-2},$$
with $a_0=1$ and $a_1=13(=\dfrac{x_3}2)$.

Now, it is trivial to check that modulo $3$, all $a_k$ are $\equiv 1$ because $14\cdot 1 - 1 \equiv 1 \mod 3$. Which implies that $3 \mid a^2-1$.

Furthermore, modulo $7$, all $a_k$ are $\equiv \pm 1$ because $a_k \equiv - a_{k-2} \mod 7$ which implies that $7 \mid a^2-1$.

And finally, modulo $4$, all $a_k$ are $\equiv 1$ because $14-1 \equiv 1  \mod 4$ which implies that $8 \mid (a-1)(a+1)=a^2-1$.

So, in summary, $56 \mid \dfrac{a^2-1}3$ as desired.
Let $3n+1=K^2$ and $4n+1=P^2$, where $P$ and $K$ are integers. Therefore, we know that $4(K^2)-3(P^2)=1$. Rearranging terms gives us $K^2= \frac {1+3P^2}4$. By testing values and guesswork we know that $P=13$ and $K=15$. Therefore $3n+1=169$, and then solving for $n$ gives us $n=56$.