pub fn k_adicity(k: u64, n: u64) -> u32
Calculates the k-adicity of n, i.e., the number of trailing 0s in a base-k representation.