Rust Translation Kumited! Please Accept
yes, sorry about that. I forgot that naming convention was different than in C#. I am not sure it is worth fixing since it will brake all the submitted solutions.
A log10 solution wouldn’t work anyway because a double is limited to 53bit of precision. For larger numbers, there would be rounding errors. That’s assuming log10 has 53bit of precision, which is probably not true.
Assuming n values are randomly distributed, the probabilities for each case will be logarithmically distributed, where 20 is most likely. Reversing the comparisons should therefore be faster.
I am marking this as resolved.
I did a simple benchmark with randomly generated numbers comparing the different implementations and different unsigned integer types. The unrolling did improve performance for most types, but not u128.
I have updated the description. Is it ok now?