Skip to main content

trajectory_len

Function trajectory_len 

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

Returns the full trajectory length including the starting value and terminal 1.

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

ยงExamples

use use_collatz::trajectory_len;

assert_eq!(trajectory_len(1), Some(1));
assert_eq!(trajectory_len(6), Some(9));