Skip to main content

total_stopping_time

Function total_stopping_time 

pub fn total_stopping_time(n: u64) -> Option<u64>
Expand description

Returns the number of steps needed to reach 1.

Returns None when n == 0 or when a checked odd step overflows.

ยงExamples

use use_collatz::total_stopping_time;

assert_eq!(total_stopping_time(1), Some(0));
assert_eq!(total_stopping_time(6), Some(8));