Hoverbear/rust-rosetta — pull request #193 by pfalabella (2014-08-07 21:42:40+00:00)
Title: hamming alternative

re-added the Hamming alternative (including @Ryman's modifications in https://github.com/Hoverbear/rust-rosetta/pull/192 ).

The part I'm not very happy about is the HammingNumber trait.
```rust
pub trait HammingNumber : Eq + Ord + Send + ToBigUint {
fn times_2(&self)-> Self;
fn times_3(&self)-> Self;
fn times_5(&self)-> Self;
fn one() -> Self;
}
```
what I'd like to do ideally is implementing `num::Mul` (instead of times_2, 3 and 5) and then `num::One` (that depends on Mul).
However this would bloat code a lot as:

1. I'd have to newtype BigUint (as I can't re-implement `Mul`)
2. I'd have to implement Mul for any multiplication between HammingNumbers even though I only need to multiply them by 2, 3 or 5 or I would need to make the the multiplication fail for any value other than 2, 3 or 5, which seems.... inelegant.