# Solving Diophantine equations

Given a complex number $z$ and a positive integer $n$, I would like to be able to find integer solutions $\alpha,\beta,\gamma$ to the Diophantine equation $$0 < a^2\vert z \vert^2 + \beta\textrm{ Re}(z) + \gamma^2 \leq n.$$ As an example, I tried

z := 2 + 3*i
Solve[0 < a^2*Norm[z^2] + b*Re[z] + c^2 <= 100,{a,b,c},Integers]


But when I hit return+shift I got "This system cannot be solved with the methods available to Solve". Can anyone explain why this doesn't work and offer a method which will work? Thanks.

• You have a couple of errors there. For one thing, Mma uses I not i. – bobbym Jan 31 '17 at 1:54

See if this is what you want:

z = 2 + 3*I;
rul = FindInstance[0 < a^2*Norm[z^2] + b*Re[z] + c^2 <= 100, {a, b, c}, Integers, 5]


Change the 5 for more or less.

0 < a^2*Norm[z^2] + b*Re[z] + c^2 <= 100 /. rul


a^2*Norm[z^2] + b*Re[z] + c^2 /. rul

• Great, thanks. Is there a way to take the solutions $(a,b,c)$ and plug them back into the equation to obtain and store the values of $a^2\vert z \vert^2 + b\textrm{ b}(z) + c^2$ at those points? – Ethan Alwaise Jan 31 '17 at 3:54
• I have added it to the answer. – bobbym Jan 31 '17 at 4:10
• Is there a way to directly list out the finitely many real numbers $x \in (0,n]$ such that $$x = a^2\vert z \vert^2 + b\textrm{Re}(z) + c^2$$ for some integers $a,b,c$? It appears that there are infinitely many solutions to the Diophantine equation I posted, but only finitely many such $x$. – Ethan Alwaise Feb 1 '17 at 2:00
• The x you have there is what is inside of FindInstance. If there are a finite number of real x (which I doubt) then it is a large number. – bobbym Feb 1 '17 at 2:31
• There must be a finite number because the set of such points $x$ is a lattice in a bounded region. – Ethan Alwaise Feb 1 '17 at 3:24