Add cycle_max_length method

Imperative elements in functional language