We will prove that p=23 is the unique solution. Subtracting the second equality from the first one, we get p(p−1)=2(y−x)(y+x). From the first equality p is odd, thus p=2 and p∣(y−x)(y+x). Clearly y>x, so assuming p∣(y−x), we get p≤y−x<y+x. Therefore,
2(y−x)(y+x)>2p2>p2>p(p−1) - a contradiction.⟹p∣(y+x).
Assuming y≥p, from the second equation it follows 49=2y2−p2≥p2, i.e., p≤7. Since 26=23+49, 27=25+49, 28=27+49 are not perfect squares, none of those values is a solution. For the remaining case y<p, we have x+y<2y<2p, thus x+y=p. So y−x=p−2x and
p−1=2(y−x)=2(p−2x)⇔p=4x−1⇔2x2−4x−48=0⇔x1,2=1±5.
Finally, since −4<0, the only solution is x=6, p=4⋅6−1=23 and y=p−x=17. Direct check confirms that this is indeed a solution.