public static byte Log_N_over_M(int n, int m) { return (byte)Math.Ceiling( Math.Log(n * 1.0 / m, 2) ); }