User:Inthar/Code: Difference between revisions

Inthar (talk | contribs)
Inthar (talk | contribs)
Line 648: Line 648:
<syntaxhighlight lang="rs">
<syntaxhighlight lang="rs">
use std::collections::BTreeSet;
use std::collections::BTreeSet;
use std::collections::HashSet;
use num_rational::Rational64 as r64;
use num_rational::Rational64 as r64;
mod plane_geometry;
mod plane_geometry;
Line 848: Line 847:
}
}


// Return a Christoffel word with `a` x's and `b` y's.
/// Return a Christoffel word with `a` x's and `b` y's.
// Algorithm from Bulgakova et al, 2023, "On balanced and abelian properties of circular words over a ternary alphabet".
/// Algorithm from Bulgakova et al, 2023, "On balanced and abelian properties of circular words over a ternary alphabet".
pub fn christoffel_word(a: u32, b: u32) -> String {
pub fn christoffel_word(a: u32, b: u32) -> String {
     let d = (gcd(a as i64, b as i64) as u32);
     let d = gcd(a as i64, b as i64) as u32;
     if d == 1 {
     if d == 1 {
         let mut result : String = String::from("");
         let mut result : String = String::from("");