Euler's Phi Function in Ruby
I’ve taken a few implementations apart and I’ve tried to figure out what the intention of Euler’s Phi function is. I think I’ve got it. I found an interesting implementation in Ruby here but it wasn’t satisfactory. Sure, the code was incredibly minimalistic, but it was also recursive and overflowed the stack for anything over 7704 iterations. I didn’t like the inflexibility of it. So I rewrote it in big ugly moron code that isn’t recursive, but is capable of scaling to some decently large totients. I might see if I can code something similar in Rust, just for shits and giggles.
By the way, the output makes for some damned interesting graphs.
|
|
I’m such a fucking brocoder. Eugh.