See *Nagell, Introduction to number theory*, Theorem 107. Originally it was proved by Legendre, see *Dickson, L. E. History of the theory of numbers. Vol. II*, p. 365. There are more examples due to Dirichlet, see *Dirichlet's Werke, Bd. 1 (1889)*, pp. 219-236. An extended bibliography on negative Pell’s equation can be found in *Gerasim, I.-Kh.I. On the genesis of Redei’s theory of the equation x 2 -Dy 2 =-1. (Russian) Zbl 0731.01014 Istor.-Mat. Issled. 32/33, 199-211 (1990)* (available in electronic form).