Please enter a positive nonsquare integer : ; or select one of the suggested values:
The fundamental solution to the Diophantine equation is given by and .
Try entering the following equalities in your Javascript console:
Note that is a fractional approximation of with
The continued fraction algorithm provides the best rational approximations of :
In the previous formula, the same pattern is repeated indefinitely
and the initial sequence is
(incidentally,
note that the first and last elements satisfy the equality
while the other elements form a palindrome).
The values of and
above were actually obtained by truncating the continued fraction to
Alternatively, these values can be obtained by the Chrakravala method:
where the following rules are used: