This question already has an answer here:

What are the conditions of solvability of the equation $p^2=2xq^2+2yq+1$ where

$p,q$ being prime and $x,y\in \mathbb{N}$?

Thank you in advance...


marked as duplicate by Dietrich Burde, Daniel W. Farlow, Willie Wong, Watson, Qwerty Sep 23 '16 at 21:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ math.stackexchange.com/questions/1776734/… $\endgroup$ – individ Sep 23 '16 at 8:56
  • $\begingroup$ That's hardly relevant, unless we do it the other way around (solving for p, q). I thought we were solving for x, y. Or... are we, really? A clarification is needed. $\endgroup$ – Ivan Neretin Sep 23 '16 at 9:19
  • $\begingroup$ Solving for x,y is preferred. $\endgroup$ – Kurtul Sep 23 '16 at 10:14
  • 4
    $\begingroup$ Then the equation is of the form $ax+by=c$, $c=p^2-1$, which has been solved, among many other MSE-questions, here. $\endgroup$ – Dietrich Burde Sep 23 '16 at 11:23

The right side of the equation is an odd number, therefore $p$ too.

$q$ devides $p+1$ or $p-1$. Therefore $p:=2kq\pm 1$, $k\in\mathbb{N}$.

$(2kq\pm 1)^2=4k^2 q^2\pm 4kq +1=2xq^2+2yq+1$

You can set $x=2k^2$ and $y=\pm 2k$ independend of $q$.

Because of $y>0$ (means $y=2k$) you can only choose $p:=2kq+1$.


Not the answer you're looking for? Browse other questions tagged or ask your own question.