# How many integer points does my favorite ellipse go through?

The equation of the ellipse interpolating the six lattice points $(0,0)$, $(1,0)$, $(0,1)$, $(d-1,d)$, $(d,d)$, $(d,d-1)$ in the plane for a fixed $d$ (at least 3) is $$x^2+y^2 - \frac{2(d-1)}{d}xy-x-y =0$$ By construction, the ellipse is symmetric with respect to the lines $x=y$ and $y=d-x$.

I would like to know exactly how many lattice points this ellipse goes through, depending on $d$. Computations suggest that the number is six most of the time and sometimes ten. No other numbers occured. An explanation of that fact (if it's true) is also very welcome.

-
"Contains"? Do you mean, "goes through"? – Gerry Myerson Nov 1 '13 at 11:34
yes, that's what I mean. – Rainer Sinn Nov 1 '13 at 11:37
For $d=200$ and $d=468$ there are $14$ points on the curve. – Peter Mueller Nov 1 '13 at 17:33
See the "Added" section in my (first) answer below what could be salvaged from my withdrawn (second) answer. – GH from MO Nov 1 '13 at 18:10
For $d=22848=2^6\times 3\times 7\times 17$ there are $22$ integer points on the curve. There are $13$ values $d<10^4$ where there are $18$ points: $1008,1190,1320,1530,1568,2448,5440,6650,6864,8432,8883,9048$ and $9328$. Each of these is also a product of fairly small primes. – Neil Strickland Aug 5 '14 at 11:18

Your equation can be rewritten as $$(x+y-d)^2+(2d-1)(x-y)^2=d(2f+d).$$ This shows that the number of integral solutions $(x,y)$ is much the same as the number of divisors of the right hand side in the ring of integers of $\mathbb{Q}(\sqrt{1-2d})$. Of course there are issues of parity to consider, but these are not too relevant. For general $d$ it is quite subtle to give an explicit formula for the number of divisors , because the class group is nontrivial (I recommend the book Cox: Primes of the form $x^2+ny^2$). At any rate, the number of solutions can be as large as $\exp(c\log f/\log\log f)$ for a constant $c=c(d)>0$, and it is easy to construct concrete examples when the number of solutions is much larger than $10$. I will give examples in the next paragraph (I plan to add another paragraph later, for slightly larger $d$).

For $d=2$ we are working in the ring of integers of $\mathbb{Q}(\sqrt{-3})$ which is a unique factorization domain. It is known that in this ring any rational prime $\equiv 1\pmod{3}$ splits into a product of two primes. This means that if $2f+d=2f+2$ has many such prime factors, the number of divisors will be large. For example, for $f=7*13*19*31-1=53598$, SAGE gives me $96$ solutions starting with $(-266,-144)$ and ending with $(268,146)$. For $f=7*13*19*31*37-1=1983162$, SAGE gives me $192$ solutions starting with $(-1625,-828)$ and ending with $(1627,830)$.

For $d=10$ we are working in the ring of integers of $\mathbb{Q}(\sqrt{-19})$ which is a unique factorization domain. It is known that in this ring any rational prime $\equiv 1, 4, 5, 6, 7, 9, 11, 16, 17\pmod{19}$ splits into a product of two primes. This means that if $2f+d=2f+10$ has many such prime factors, the number of divisors will be large. For example, for $f=5*7*11*17*23-5=150530$, SAGE gives me $96$ solutions starting with $(-885,-802)$ and ending with $(895,812)$. For $f=5*7*11*17*23*43-5=6473000$, SAGE gives me $192$ solutions starting with $(-5831,-5290)$ and ending with $(5841,5300)$.

Added. It turns out that the original question concerned the special case $f=0$. I discussed that case in a second answer that was incorrect, unfortunately. Here I collect what could be salvaged from that answer as it might be useful for later investigations. The equation can be rewritten as $$(2d-1)(x-y)^2=(x+y)(2d-x-y),$$ where all factors can be seen to be nonnegative integers. The case $x=y$ yields the lattice points $(0,0)$ and $(d,d)$. In the case $x\neq y$ we have a factorization into positive integers $$2d-1=d_1d_2,\quad (x-y)^2=b_1b_2,\quad x+y=d_1b_1,\quad 2d-x-y=d_2b_2,$$ and the case when $d_1$ or $d_2$ equals $1$ yields the other four listed lattice points $(0,1)$, $(1,0)$, $(d-1,d)$, $(d,d-1)$. These observations certainly show (without any algebraic number theory) that the number of solutions is $O_\epsilon(d^\epsilon)$, and a good approach seems to consider the system $$d_1d_2=2d-1,\quad b_1b_2=\square, \quad d_1b_1+d_2b_2=2d.$$ It is worthwhile to note that $d_1$ and $d_2$ are coprime here, which implies that the six listed lattice points are the only ones when $2d-1$ is a prime power.

-
Thank you for your answer! Unfortunately, it is not quite what I meant. I guess, writing $f = x^2+y^2-s(d-1)/d xy -x -y$ is confusing. What I really want to know is, how many lattice points lie on the plane curve defined by $x^2+y^2-2(d-1)/d xy-x-y =0$. So $f$ was meant to just be a (superfluous) symbol for the polynomial. I'm sorry for the confusion. Thanks for answering. – Rainer Sinn Nov 1 '13 at 15:41
I see. I will look into the clarified question as time permits. – GH from MO Nov 1 '13 at 16:14

(Not an answer, just examples.) Here are Rainer's ellipses for $d=5$ and $d=8$. The first passes through $6$ lattice points, the second through $10$.

-
What is that good for? Given the five points which lie on the curve, it's obvious that the curves look like that. – Peter Mueller Nov 1 '13 at 17:43
I was merely illustrating the OP's $6$- & $10$-points observation. – Joseph O'Rourke Nov 1 '13 at 19:13

If the ratio of " $d$ " negative then the equation can be rewritten as:

$$a^2+b^2-\frac{2(d+1)ab}{d}-a-b=0$$

Then this equation. If there is a solution - they are infinitely many.

Finding solutions-it factor. To factor. $d=tq$

We use the solutions of the equation Pell. $p^2-(2d+1)s^2=t$

Then the solutions are.

$$a=q((2d+1)s+p)s$$

$$b=q((2d+1)s-p)s$$

$$...$$

$$a=q(s-p)p$$

$$b=-q(s+p)p$$

-