usenum_bigint::BigUint;usenum_traits::Zero;/// Calculates the k-adicity of n, i.e., the number of trailing 0s in a base-k
/// representation.
pubconstfnk_adicity(k:u64, mutn:u64)->u32{if n ==0{return0;}letmut r =0;while n % k ==0{
r +=1;
n /= k;}
r
}/// Calculates the k-adicity of n, i.e., the number of trailing 0s in a base-k
/// representation.
pubfnk_adicity_big_int(k: BigUint, mutn: BigUint)->u32{if n.is_zero(){return0;}letmut r =0;while(&n %&k).is_zero(){
r +=1;
n /=&k;}
r
}