Crate pell_equation

Source
Expand description

Solve Pell’s equation

use rug::Integer;
let v = pell_equation::solve_pell(Integer::from(2));
assert_eq!(v, pell_equation::Solution::Negative(Integer::from(1), Integer::from(1)));
let w = pell_equation::solve_pell(Integer::from(3));
assert_eq!(w, pell_equation::Solution::Positive(Integer::from(2), Integer::from(1)));

Enums§

Solution
Fundamental solution of x^2 - d*y^2 = ±1

Functions§

continued_fraction_of_sqrt
Calculate continued fraction of √d
solve_pell
Calculate fundamental solution of x^2 - d*y^2 = ±1
solve_pell_negative
Calculate fundamental solution of x^2 - d*y^2 = -1
solve_pell_positive
Calculate fundamental solution of x^2 - d*y^2 = 1