/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_is_prime.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/05 10:54:36 by jhalford #+# #+# */ /* Updated: 2016/08/07 17:42:09 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ int ft_is_prime(int nb) { int i; if ((nb % 2 == 0 && nb != 2) || nb <= 1) return (0); i = 3; while (i * i <= nb) { if ((nb % i) == 0) return (0); i += 2; } return (1); }