in src/dp.rs [102:125]
fn find_dp_u32(value: &str, base: u32) -> Vec<String> {
let mut exp = BigUint::new(vec![base]);
let mut ret: Vec<String> = Vec::new();
let val = BigUint::from_str_radix(value, base).unwrap();
let val_plus1 = &val + BigUint::one();
ret.push(val.to_str_radix(base));
// We use prev to detect consecutive duplicate entries (a trick to avoid HashSet)
let mut prev = val.clone();
while exp < val {
// optimizing out the unneeded values to get a minimal dominating partition
if &val_plus1 % &exp != BigUint::zero() {
// (x//b^i - 1) * b^i + (b-1)
let temp = &val / &exp * &exp - BigUint::one();
if prev != temp {
ret.push(temp.to_str_radix(base).to_string());
prev = temp;
}
}
exp *= base;
}
ret
}