# For what kind of positive integers $m+n+m^2+n^2 \mid m^3+n^3$ holds?

Determine all pairs of positive integers $(m, n)$ such that$$\frac{m^3+n^3}{m^2+n^2+m+n}$$is an integer.

This is a simpler version of a problem that I made a few years ago. There are infinitely many solutions. Such as parametric forms for $(m, n)$ that @Ivan Neretin has provided.

Let us consider $m>n$ due to symmetry (There is no solution for $m=n$). Let $m=ad$ and $n=bd$ for co-prime positive integers $a$ and $b$ and $a>b$. We get$$d^2(a+b)\big(a^2+b^2-ab\big)=k\big[d(a^2+b^2)+a+b\big]. \tag{1}$$

After @Geoff Robinson's first comment, I was looking for possible values of$$D=\gcd\big(m+n, m^2+n^2+m+n\big),$$which is$$D=\gcd\big(m+n, (m+n)^2-2mn+m+n\big)=\gcd(m+n, 2mn).$$and$$D=\gcd\big(d(a+b), 2d^2ab)=d \gcd(a+b, 2d).$$ Since $\gcd(a+b, ab)=1$.

Then I used equation $(1)$ and the relation between $d$ and $\gcd(a+b, 2d)$, for finding a relation between $d$ and $a+b$. I think it can be the key for solving the problem.

After looking at patterns using a code, I realized that actually there is a relation between $d$ and $a+b$. It is interesting that for most of the solutions we get $\gcd(a+b, 2d)=2d$ and $\frac{d}{a+b}=\frac{1}{4}$.

• One parametric solution is immediately obvious: $n=k(2k-1), m=k(2k+1)$. It does not cover all solutions, though. Commented May 25, 2017 at 8:07
• How did you see it? What was your intuition? Commented May 25, 2017 at 9:14
• I looked at all solutions with $m,n<100$, and just recognized them instantly. Commented May 25, 2017 at 9:28
• If it's helpful, all the solutions for $m,n < 10000$ not of the form given by @IvanNeretin are (30, 6), (66,24), (228, 60), (580, 120), (1002, 654), (1230, 210), (2052, 864), (2145, 1023), (2310, 336), (3192, 1218), (3258, 1926), (3388, 1188), (3976, 504), (5768, 2296), (6273, 451), (6372, 918), (6408, 720), (9810, 990) Commented May 25, 2017 at 19:48
• I've got another parametric solution which is somewhat less obvious that the previous: $n=(k-1)\cdot k\cdot(k+1), m=(k-1)\cdot k\cdot(k^2+k-1)$. Much like the first one, it covers many of the remaining solutions, but not all of them. Commented May 26, 2017 at 7:37

Parametric solutions found (by Ivan Neretin): \begin{align}m = k(2k+1), &\quad n=k(2k-1) \\ m = k(k-1)(k^2+k-1), &\quad n=k(k-1)(k+1)\end{align} Solutions found outside of the above patterns (covers all solutions for $n \leq m \leq 2300000$):

      m         n       T/B      d      a      b
30         6        28      6      5      1
1002       654       897      6    167    109
2052       864      1872    108     19      8
2145      1023      1936     33     65     31
3192      1218      2940     42     76     29
3258      1926      2912     18    181    107
3388      1188      3146     44     77     27
5768      2296      5292     56    103     41
6273       451      6242     41    153     11
6372       918      6260     54    118     17
10872      6408      9720     72    151     89
16302      4636     15428     38    429    122
18208     12512     16380     32    569    391
20193     13515     18126    159    127     85
21414      6142     20252    166    129     37
33462      5742     32668    198    169     29
34086      6118     33212    874     39      7
34476      6708     33462    156    221     43
39015     25785     34992    135    289    191
44520     11928     42336    168    265     71
44940     25620     40200    420    107     61
55870     12580     53780    370    151     34
81054     53082     72657     54   1501    983
87363      6273     86946    153    571     41
92736     37408     84992    224    414    167
105490     63910     94325    770    137     83
111120     50160    100800    240    463    209
111948     79572    101080    228    491    349
123820     44280    114800    820    151     54
150048     57312    138240    288    521    199
168280    113960    151200    280    601    407
173652     35148    168200    348    499    101
182505     45195    174570    345    529    131
193830    110370    173394    390    497    283
200784     84372    183312   1068    188     79
218880    112896    196608   2304     95     49
268362    106182    246408    306    877    347
274533    205275    249696    357    769    575
290475     39525    285912     75   3873    527
306360     63940    296240    460    666    139
360780    193620    323400    420    859    461
372372     65100    363258   2604    143     25
405790    186186    367598   4774     85     39
415443    113953    394346    511    813    223
445018     85652    432180   1862    239     46
503244    256212    452392     36  13979   7117
520740    143550    494100    990    526    145
599280    465168    548856    528   1135    881
719448    101928    707296    744    967    137
733800    389400    658125    600   1223    649
802740    237660    757200   1020    787    233
911820    211380    876096    780   1169    271
1005420    304980    946400    780   1289    391
1043610    620490    933100   1290    809    481
1070895    790305    971960    705   1519   1121
1195947    955413   1102240    747   1601   1279
1299892    560604   1183952   1364    953    411
1359402   1203312   1290828   2838    479    424
1420860    243780   1387200   1020   1393    239
1536210     99990   1530150   9090    169     11
1543302    688734   1401372   1494   1033    461
1776373    521883   1676696    379   4687   1377
1777440    219360   1754064    480   3703    457
1835856    673200   1698048   1584   1159    425
1969620    845580   1794690   1020   1931    829
2034960    283560   2001600  16680    122     17
2171580   1255620   1942080   1020   2129   1231
2222580   1816620   2059992   1020   2179   1781
2271720    326040   2232450   1320   1721    247


Necessary conditions (by Geoff Robinson): Either $m$ and $n$ share a common factor, or they are both odd. If they are both odd, then $m+n \equiv 0$ mod $4$.

Moreover, $m$ and $n$ have the same parity. Proof: The denominator $B=m^2+n^2+m+n$ is even. The numerator $T=m^3+n^3$ is a multiple of $B$, so is even, so $m^3$ and $n^3$ have the same parity, so $m$ and $n$ have the same parity.

This means that if $d$ is odd, $a$ and $b$ are odd. I (Rosie F) notice that in most cases $d$ is even. But it is quite rare that either $a$ or $b$ is even.

We also can remark that the only coprime solution is $(m,n)=(3,1)$. To show this assume $(m,n)=1$. Also note that $m^3+n^3=(m+n)(m^2+n^2-mn)$, so the original quantity is an integer iff $$m^2+n^2+m+n\mid (m+n)(m+n+mn)$$ Of course this is true iff $m^2+n^2+m+n\mid \gcd(m^2+n^2+m+n, m+n)(m+n+mn)$, which simplifies to $m^2+n^2+m+n\mid \gcd(m+n, 2mn)(m+n+mn)$. Much like Geoff noted, this can only be the case when $\gcd(m+n, 2mn)>1$ since $m^2+n^2+m+n>m+n+mn$. However under the assumption that $\gcd(m,n)=1$, this is only the case when $m$ and $n$ are both odd and $\gcd(m+n, 2mn)=2$. Hence our original quantity is an integer only if $$m^2+n^2+m+n\mid 2(m+n+nm)$$ and $m$ and $n$ are odd. Assume $m^2+n^2+m+n\neq 2(m+n+nm)$, then for some prime $p$, $m^2+n^2+m+n\mid 2(m+n+nm)/p$ and thus $$m^2+n^2+m+n\le 2(m+n+nm)/p\le m+n+nm$$ which is false. Hence $m^2+n^2+m+n=2(m+n+nm)$ and $(m-n)^2=n+m$. This gives $m-n\mid n+m$ so $$m-n=\gcd(m-n,n+m)=\gcd(m+n, 2m)=2$$ Thus $m=n+2$. Subbing this into $(m-n)^2=m+n$ gives $(m,n)=(3,1)$. Thus if $\gcd(m,n)=1$ we must have $(m,n)=(3,1)$, which if we test works.

For the equation.

$$x^3+y^3=q(x^2+y^2+x+y)$$

We use the solutions of the equation Pell.

$$p^2-(3k-2t)(2t-k)s^2=1$$

Then the solution can write.

$$x=((3k-2t)s+p)2ts$$

$$y=\frac{t}{k-t}(p^2+2(2k-t)ps+(3k-2t)ks^2)$$

$$q=\frac{t^2}{k(k-t)}(p^2+2(3k-2t)ps+(3k-2t)^2s^2)$$

And again.

$$y=((3k-2t)s-p)2ts$$

$$q=\frac{4(3k-2t)}{k}t^2s^2$$

All the numbers can have any sign.