  The purpose of this article is to give the solutions of the inverse problem
for Pellian equations. For any rational number $0< a/b < 1$, the fundamental
discriminants $D$ satisfying $(\lfloor \sqrt{D} \rfloor b + a)^2 - D b^2 = 4$
are given in terms of a quadratic progression. There were studies about this
problem based on symmetric sequences $\{a_1,\...,a_{l-1}\}$ and periodic
continued fractions $[a_0,\bar{a_1,\...,a_{l-1},a_l}]$, but in this article we
solve the problem in a completely different way with simpler parameters. The
result is obtained by measuring the quality of approximation of a rational
number to $\sqrt{d}$ or $\frac{1+\sqrt{d}}{2}$, and by defining a short
interval attached to each rational number. On this formulation we also show
that for almost all square-free integer $d$, $d$ is the least element of the
prescribed quadratic progression for some $a/b$.
