From 7a755f7b050f6d7b42536519e9ed7881d253778d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Mon, 1 Mar 2021 18:51:53 +0100 Subject: [PATCH] Fixed bug. --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index ae30ac5..05f2fb2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,9 +36,9 @@ fn main() { let mut i = 0; let mut test_prime = primes.get(i).unwrap(); let mut is_prime = true; - while *test_prime < (candidate as f64).sqrt() as u64 + while *test_prime <= (candidate as f64).sqrt() as u64 { - if candidate % test_prime == 0 + if candidate % *test_prime == 0 { is_prime = false; break;