/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_collatz_conjecture.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/04 01:39:43 by gtertysh #+# #+# */ /* Updated: 2016/11/04 04:01:26 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ unsigned int ft_collatz_conjecture(unsigned int base) { static unsigned int i = 0; i++; if (base == 1) return (i); else if (base % 2 == 0) return (ft_collatz_conjecture(base / 2)); else return (ft_collatz_conjecture(base * 3 + 1)); }