# Pell type equation: $x^2-py^2=a$

Let $p=4k+1$ be a prime number such that $p=a^2+b^2$, where $a$ is an odd integer.Prove that the equation $$x^2-py^2=a$$ has at least a solution in $\mathbb{Z}$.

-
A standard way to find $a,b$ begins by expanding $\sqrt p$ in a continued fraction; if you stop halfway through the period of the continued fraction, somehow you get $a$ and $b$. I bet solving $x^2-py^2=a$ is related to this. Sorry I can't be more precise. –  Gerry Myerson Aug 5 '12 at 23:39
$p=13$, $a=3$, $x=4$, $y=1$. –  SiliconCelery Aug 6 '12 at 0:07
@Sil, I think the idea was to prove that for every such $p$ there's at least one solution. –  Gerry Myerson Aug 6 '12 at 5:27
@GerryMyerson, Ah, in my defence, that wasn't made very clear. –  SiliconCelery Aug 6 '12 at 10:47