Crate pell_equation

Crate pell_equation 

Source
Expand description

Solve Pell’s equation

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

Enums§

Error
Error type
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