How can i solve this diophantine equation:$x^2-(6p-4q)x+3pq=0$? I found this diophantine equation $$x^2-(6p-4q)x+3pq=0$$ (p and q both prime numbers) and i posted my answer but i want to know if there are other methods to find the solutions of this equation. What do you think?
 A: If $r_1,r_2$ are the roots of equation:
$$r_1+r_2=6p-4q$$
$$r_1\cdot r_2=3pq$$
From second equation we can note that $r_1$ and $r_2$ have to be divisors of $3pq$ and the only solutions are $$(1;3pq),(3;pq),(3p;q),(3q,p),(-1;-3pq),(-3;-pq),(-3p;-q),(-3q;-p)$$
Therefore there are eight equations:
1) if the roots are $1$ and $3pq$:
$$6p-4q=1+3qp$$ but if $p$ and $q$ are positive                $6p>3pq$ therefore $q<2$. Impossible.
2) if the roots are $-1$ and $-3pq$: 
$$4q-6p=1+3pq$$ but we note that $4q>3pq$ therefore $p<4/3$. Impossible.
3) if the roots are $3$ and $pq$ the equation becomes:
$$6p-4q=3+pq$$ and $6p>pq$ and therefore $q<6$ and possibles values of $q$ are $3$ or $5$ replacing these values of $q$ we find the solutions $(5;3),(23,5)$.
4) if the roots are $-3$ and $-pq$: 
$$4q-6p=3+pq$$ but $4q>pq$ and therefore $p<4$ and the only possibile valor of $p$ is $3$ and replacing in the equation we obtain $q=21$ that isn't a prime number. 
5)if the roots are $3p$ and $5q$:
$$6p-4q=3p+q$$ therefore $3p=5q$ and the only solution is rappresented by $p=5$ and $q=3$. 
6) if the roots are $-3p$ and $-q$ the equation becomes:
$$4q-6p=3p+q$$ and $q=3p$ therefore impossible.
7) if the roots are $3q$ and $p$:
$$6p-4q=3q+p$$ and $5p=7q$ and the only solution is $p=7$ and $q=5$.
8) if the roots are $-3q$ and $ 
-p$ the equation becomes $$4q-6p=3q+p $$ and $q=7p$ and $q$ isn't a prime number.
A: By the quadratic formula, this is equivalent to determining when $9p^2 - 15p q + 4 q^2$ is a perfect square, so you could adapt the technique used to find primitive Pythagorean triples.
Looks pretty messy when I try it, though.
A: This is a second degree equation which have integer solutions if and only if it's reduced discriminant is a square of an integer which is equivalent to:
$$9p^2-15pq+4q^2=x^2 $$
for some integer $x$ and this can be simplified to:
$$(3p-q)(3p-4q)=x^2 $$
and because if $q\neq 3$ and $p\neq q$ we have$3p-q$ and $3p-4q$ are coprime then:
$$3p-q=u^2\\ 3p-4q=v^2$$
and hence $(u-v)(u+v)=u^2-v^2=3q$ which gives you some finite cases to test
