Created
July 30, 2021 21:27
-
-
Save Jackzmc/7aa2cedc75c20a77eefa70ef87ae8dfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn main() { | |
| let mut i: u64 = 0; | |
| let mut v: u64; | |
| let mut highest = u64::MIN; | |
| loop { | |
| i += 1; | |
| v = i; | |
| loop { | |
| // Is even | |
| if v % 2 == 0 { | |
| v /= 2; | |
| } else { | |
| v = 3 * v + 1; | |
| } | |
| if v > highest { | |
| highest = v; | |
| } | |
| if v == 1 { | |
| if i % 1_000_000 == 0 { | |
| println!("{:10}: All Pass | HI {:10}", i, highest); | |
| } | |
| break; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment