2 ms·
Eh, 0 is an infinite loop in that function. It also doesn't implement the collatz conjecture. It implements the collatz-conjecture mod (usize::MAX + 1). I don'
by gpm 3y ago
Eh, 0 is an infinite loop in that function.
It also doesn't implement the collatz conjecture. It implements the collatz-conjecture mod (usize::MAX + 1). I don't know about that modulus specifically, but there are m where the collatz conjecture mod m is false.
https://www.researchgate.net/profile/Cganesa-Moorthy/publication/316141441_Collatz_Conjecture_for_Modulo_an_Integer/links/58f21cadaca27289c21671cf/Collatz-Conjecture-for-Modulo-an-Integer.pdf https://www.researchgate.net/profile/Cganesa-Moorthy/publica...
Edit: (2^64 - 1) / 3 is an integer and also trivially infinitely loops (by going to 0).
- Georgelemental 3y ago> It implements the collatz-conjecture mod (usize::MAX + 1). Only if you have overflow checking disabled.
- gpm 3y agoOf course, if overflow checking isn't disabled returning true is wrong because of panicking instead of infinite loops.