Counting Solutions of a Quadratic Diophantine Equation

326 Views Asked by At

How can one construct a function $f(n)$ that counts the number of solutions of the equation $$x^2+y^2-n(x+y) = 0,\quad x,y\in\mathbb{Z},$$ where $n\in\mathbb{Z}^+$? For example, we have $f(1)=f(2)=f(3)=f(4)=4$, and $f(5)=12$; what is $f(n)$?

1

There are 1 best solutions below

0
On

Multiply both sides by $4$ and the equation can be rewritten as:

$$(2x-n)^2 + (2y-n)^2 = 2n^2 $$

You can use equations $(1)$ and $(2)$ in this Mathworld Article to compute the number of solutions. There's a proof I'd seen for that theorem that uses algebraic number theory but I can't remember where I saw it.