Given x2 - Dy2 = 1, you can get to some really cool equations using elementary methods, valid for the special cases x = 1 or -1 mod D.
Using those equations, you can get a result involving a sum, which is x+y, and squares:
x+y = n2 + (D-1)m2
2(x+y) = n2 + (D-1)m2
for some integers n and m.
I've recently explained in a post how to calculate n and m when you know x and y.