Crate collatz

source ·

Functions

  • Return a list of containing the collatz steps for the specified number The initial number will not be part of the list. The list will always end with the values 4, 2, 1 unless you found a mathematic breakthrough ;-) The length of the list will be the same as the number returned by count_steps: get_steps(N).len() == count_steps(N) For zero the function will return an empty list
  • Count the number of collatz steps for the specified number All the steps required to reach 1 will be counted. For zero the function will return 0