Earlier quoted context omitted.
Same algorithm in Rust finds 2172315626468283465 in about 3 seconds on my M1 Pro. $ time cargo run --release Finished `release` profile [optimized] target(s) in 0.02s Running `target/release/p45` 0 1 40755 1533776805 57722156241751 2172315626468283465 cargo run --release 2.95s user 0.04s system 98% cpu 3.029 total Runs on the Rust Playground too: https://play.rust-lang.org/?version=stable&mode=release&edit...
Neat! I translated my code to Rust line-for-line and the iterator approach significantly outperforms it. Rust newbie q - why use `x.wrapping_sub()` instead of regular old `x - 1`? Seems like we're never going to underflow `usize` for any of the 3 formulae?
Because I coded it to start at x=0, which will underflow and will panic in debug mode.