Figured I’d write a much quicker varient of the Totient Function in Rust. Excellent language. I don’t have a grasp on the finer points available to Rustaceans, but I can hopefully put concurrency and whatnot to use at some point. The code is quick, but I know it can be quicker if I just spend some time putting it together.
This is the quick crap I dreamt up:
The code should compile with no problems. Yes, I realize that u64 is overkill. No, my code will never require unsigned 2^64 integers. It may be a quirky choice, but whatever. Change to u32 as needed, though I’m sure it won’t be a problem for anyone.