pub fn weird_algorithm(start: u64) -> String {
    if start == 0 {
        panic!("Expected positive integer.")
    }

    if start == 1 {
        return "1".to_string();
    }

    match start % 2 {
        0 => format!("{} {}", start, &weird_algorithm(start / 2)),
        1 => format!("{} {}", start, &weird_algorithm(start * 3 + 1)),
        _ => unreachable!(),
    }
}
/// Given a positive integer, returns a string with the Collatz sequence starting from that number, space-separated.
///
/// # Examples
/// ```rust
/// # use alon::*;
/// let result = weird_algorithm(3);
/// let expected = "3 10 5 16 8 4 2 1";
/// assert_eq!(result, expected);
/// ```
Given a positive integer, returns a string with the Collatz sequence starting from that number, space-separated.
Given a positive integer returns a string with the Collatz sequence starting from that number space - separated .
pub fn weird_algorithm(start: u64) -> String {
    if start == 0 {
        panic!("Expected positive integer.")
    }
    if start == 1 {
        return "1".to_string();
    }
    match start % 2 {
        0 => format!("{} {}", start, &weird_algorithm(start / 2)),
        1 => format!("{} {}", start, &weird_algorithm(start * 3 + 1)),
        _ => unreachable!(),
    }
}
pub fn weird_algorithm ( start : u64 ) -> String { if start == 0 { panic ! ( " " ) } if start == 1 { return " " . to_string ( ) ; } match start % 2 { 0 => format ! ( " " start weird_algorithm ( start 2 ) ) , 1 => format ! ( " " start weird_algorithm ( start 3 1 ) ) , _ => unreachable ! ( ) , } }
Given a positive integer, returns a string with the Collatz sequence starting from that number, space-separated.
Given a positive integer returns a string with the Collatz sequence starting from that number space - separated .
start
u64
examples
None
use alon::*;
let result = weird_algorithm(3);
let expected = "3 10 5 16 8 4 2 1";
assert_eq!(result, expected);
```
let result = weird_algorithm ( 3 ) ; let expected = " 3 10 5 16 8 4 2 1 " ; assert_eq! ( result expected ) ; ` ` `