Pell Equation Solver

This calculator solves the Pell equation x2ny2=1 where n is a nonsquare positive integer. The calculator firstly finds the regular continued fraction [a0;a1,a2,] of n using continued fractions calculator and then calculate the sequence of convergents pk/qk until they satisfy the equation above. This is the fundamental solution (x1,y1). As the Pell equation has many solutions all remaining solutions may be calculated from the relation xm+ymn=(x1+y1n)m by expanding the right side, equating coefficients of n on both sides, and equating the other terms on both sides. For example, the fundamental solution of x27y2=1 is (x1,y1)=(8,3). We calculate the solution (x2,y2) from x2+y27=(8+37)2=82+487+(37)2=127+487 so we have (x2,y2)=(127,48) as another solution.

Pell Equation Calculator