How to solve these two simultaneous "divisibilities" : $n+1\mid m^2+1$ and $m+1\mid n^2+1$

Is it possible to find all integers $m>0$ and $n>0$ such that $n+1\mid m^2+1$ and $m+1\,|\,n^2+1$ ?

I succeed to prove there is an infinite number of solutions, but I cannot progress anymore.

Thanks !

• Could you write down your proof for the infinite number of solutions? It may help everyone. Feb 25, 2016 at 8:22
• If you understand French, there is a long discussion (partly numerical, partly theoretical) here Feb 25, 2016 at 8:28
• Yes, I understand French: in fact, I participated in this discussion. One of the participants (serge17) managed to find a method to build "big" solutions $(m,n)$ : Using his method, we can prove that there are infinitely many solutions.
– user14479
Feb 25, 2016 at 8:37
• @individ : for $N=1,2,3,4$, the solutions $(m,n)$ are : $(33,217)$ , $(22641,961753)$ , $(263568049,55479822393)$ , $(45074835574129,41942086060150713)$.
– user14479
Feb 29, 2016 at 14:25
• If (n+1) | m^2 + 1 and (m+ 1) | n^2 + 1 then (n + 1) | ( m + 1) ^2 - 2m and ((m+1) ^ 2) | n^4 + 2 (m^2) + 1 therefore ( n + 1) | (n^4 + 2( n^2) + 1)/ h - 2m , for some integer h . So ( n+ 1) | (n^4 + 2( n^2) + 1 - (2m h)) , so (n+1) | (4n^2 - (2 m h)) and ( n+1) | 2( m h +2) . 2| m iff 2| m , so if 2| n then ( n+1) | (m h +2) and similarly ( m+1) | ( n k+ 2) for some k an element of integers. I don't know if this helps.... Mar 15, 2016 at 23:39

Some further results along the lines of thought of @individ:

Suppose $p$ and $s$ are solutions to the Pell's equation: $$-d\cdot p^2+s^2=1$$ Then, \begin{align} m &= a\cdot p^2+b\cdot pq +c\cdot q^2\\ n &= a\cdot p^2-b\cdot pq +c\cdot q^2 \end{align} are solutions if $(a,b,c,d)$ are: (these are the only sets that I found using the computer) \begin{align} (10,4,-2,-15)\\ (39,12,-3,-65)\\ \end{align} Sadly, the solutions are negative.

Here are some examples: \begin{align} (m,n) &= (-6,-38) &(a,b,c,d,p,q)&=(10,4,-2,-15,1,4)\\ (m,n) &= (-290,-2274) &(a,b,c,d,p,q)&=(10,4,-2,-15,8,31)\\ (m,n) &= (-15171,-64707) &(a,b,c,d,p,q)&=(39,12,-3,-65,16,129)\\ (m,n) &= (-1009692291,-4306907523) &(a,b,c,d,p,q)&=(39,12,-3,-65,4128,33281)\\ (m,n) &= (-67207138138563,-286676378361411) &(a,b,c,d,p,q)&=(39,12,-3,-65,1065008,8586369)\\ \end{align} P.S. I am also very curious how @individ thought of this parametrization.

It is convenient to introduce $$x:=m+1$$ and $$y:=n+1$$. Then $$\begin{cases} x\ |\ y^2 - 2y + 2,\\ y\ |\ x^2 - 2x + 2. \end{cases}$$ It follows that $$\gcd(x,y)\mid 2$$, and thus there are two cases to consider:

Case $$\gcd(x,y)=1$$. We have $$xy\ |\ x^2 + y^2 - 2x - 2y + 2.$$

This is solved via Vieta jumping. Namely, one can show that $$\frac{x^2 + y^2 - 2x - 2y + 2}{xy}\in\{ 0, -4, 8 \}$$. The value $$0$$ corresponds to an isolated solution $$x=y=1$$, while each of the other two produces an infinite series of solutions, where $$x,y$$ represent consecutive terms of the following linear recurrence sequences: $$1,\ -1,\ 5,\ -17,\ 65,\ \dots \qquad(s_k=-4s_{k-1}-s_{k-2}+2)$$ and $$-1, -1, -5, -37, -289,\ \dots, \qquad(s_k=8s_{k-1}-s_{k-2}+2).$$

However, there are no entirely positive solutions here.

Case $$\gcd(x,y)=2$$. Letting $$x:=2u$$ and $$y:=2v$$ with $$\gcd(u,v)=1$$, we similarly get $$\begin{cases} u\ |\ 2v^2 - 2v + 1,\\ v\ |\ 2u^2 - 2u + 1. \end{cases}$$ Unfortunately, Vieta jumping is not applicable here. Still, if we fix $$k:=\frac{2u^2 + 2v^2 - 2u - 2v + 1}{uv},$$ then the problem reduces to the following Pell-Fermat equation: $$((k^2-16)v + 2k+8)^2 - (k^2-16)(4u - kv - 2)^2 = 8k(k+4).$$

Example. Value $$k=9$$ gives $$z^2 - 65t^2 = 936.$$ with $$z:=65v + 26$$ and $$t:=4u - 9v - 2$$. It has two series of integer solutions in $$z,t$$: $$\begin{bmatrix} z_\ell\\ t_\ell\end{bmatrix} = \begin{bmatrix} 129 & -1040\\ -16 & 129\end{bmatrix}^\ell \begin{bmatrix} z_0\\ t_0\end{bmatrix}$$ with initial values $$(z_0,t_0) \in \{(39,-3),\ (-1911,237)\}$$.

Not every value of $$(z_\ell, t_\ell)$$ corresponds to integer $$u,v$$. Since the corresponding matrix has determinant 260, we need to consider sequences $$(z_\ell, t_\ell)$$ modulo 260. It can be verified that only first sequence produces integer $$u,v$$ and only for odd $$\ell$$, that is $$\begin{split} \begin{bmatrix} v_s\\ u_s\end{bmatrix} &= \begin{bmatrix} 65 & 0\\ -9 & 4\end{bmatrix}^{-1}\left(\begin{bmatrix} 129 & -1040\\ -16 & 129\end{bmatrix}^{2s+1} \begin{bmatrix} 39\\ -3\end{bmatrix} + \begin{bmatrix} -26\\ 2\end{bmatrix}\right)\\ &=\begin{bmatrix} 70433 & -16512\\ 16512 & -3871\end{bmatrix}^s \begin{bmatrix} 627/5 \\ 147/5\end{bmatrix} - \begin{bmatrix} 2/5 \\ 2/5\end{bmatrix} \end{split}$$ or in a recurrence form: $$\begin{cases} v_s = 70433\cdot v_{s-1} -16512\cdot u_{s-1} + 21568,\\ u_s = 16512\cdot v_{s-1} -3871\cdot u_{s-1} + 5056, \end{cases}$$ with the initial value $$(v_0,u_0) = (125, 29)$$. The next couple of values is $$(8346845, 1956797)$$ and $$(555582723389, 130248348509)$$, and it can be seen that the sequence grows quite fast.

UPDATE. Series of positive solutions exist for $$k\in \{9, 13, 85, 97, 145, 153, 265, 289, 369, \dots\}.$$ Most likely, this set is infinite, but I do not know how to prove this.

• Interesting :-) May 28, 2022 at 18:58

You can record a similar system:

\left\{\begin{aligned}&m^2+t^2=(n+t)z\\&n^2+t^2=(m+t)k\end{aligned}\right.

Parametrization of solutions we write this.

$$m=q(3x-q)$$

$$n=2x^2-qx-q^2$$

$$t=3q^2-3xq+2x^2$$

$$z=5q^2-2qx+x^2$$

$$k=5q^2-8qx+4x^2$$

Consider a special case.

\left\{\begin{aligned}&m^2+1=(n+1)z\\&n^2+1=(m+1)k\end{aligned}\right.

Using the solutions of the equation Pell.

$$p^2-15s^2=1$$

Enough to know first, everything else will find a formula. $(p;s) - (4;1)$

$$p_2=4p+15s$$

$$s_2=p+4s$$

The solution then write.

$$m=-2p^2-4ps+10s^2$$

$$n=-2p^2+4ps+10s^2$$

$$z=8m+9-n$$

$$k=8n+9-m$$

These solutions are negative.

And a positive decision of the same are determined by the Pell equation.

$$p^2-65s^2=-1$$

Use the first solution. $(p;s) - (8;1)$

Next find the formula.

$$p_2=129p+1040s$$

$$s_2=16p+129s$$

Will make a replacement.

$$x=p^2+6ps+13s^2$$

$$y=p^2-6ps+13s^2$$

The decision record.

$$m=2x-1$$

$$n=2y-1$$

$$z=9x-2y+2$$

$$k=9y-2x+2$$

• In your parametrization, with t = 1, we have $1 = 3q^2 - 3xq + 2x^2$, or equivalently $2x^2 - 3xq + (3q^2-1) = 0$. This equation can be solved in numbers only if the discriminant $9q^2 - 8(3q^2- 1) = 8 - 15q^2$ is a square, but this is obviously impossible. So, either your parametrization is OK and there is no solution, or your parametrization is wrong. Jan 14, 2019 at 15:50
• @MikeTeX there are several solutions. One of these decisions was mentioned. It's private. Other solutions need to be considered. Look. Several of them. Jan 14, 2019 at 16:18

I now have a pdf containing the text that I could not place on the margin of Gauss' masterpiece. Anyone interested?

The pdf contains a full classification of (all) solutions and a procedure on how to generate them all.

simultaneouos_divisions_MSE.pdf

– qwr
Jan 9, 2019 at 20:34

To solve this system of equations - it is necessary to solve the system.

\left\{\begin{aligned}&m^2+t^2=(n+t)z\\&n^2+t^2=(m+t)k\end{aligned}\right.

It is necessary to find a parameterization to figurirovallo Pell. It is possible for example to record this.

$$m=33643p^2\pm5404ps+217s^2$$

$$n=5491p^2\pm852ps+33s^2$$

$$t=s^2-153p^2$$

$$z=212041p^2\pm34274ps+1385s^2$$

$$k=901p^2\pm134ps+5s^2$$

We need a case of when. $t=s^2-153p^2=1$

Knowing the first decision $(s ; p ) - (2177;176)$

The rest can be found by the formula.

$$s=2177s+26928p$$

$$p=176s+2177p$$

Although this equation can be not enough. We need to find when there are multiple solutions.