From 5aa0b333c02776824eb2b1ae995c0fd8bb35f4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Tue, 13 Dec 2016 16:32:10 +0100 Subject: [PATCH] Made a fix, because previously it was not measuring primes. --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 3d09e98..7689138 100644 --- a/src/main.c +++ b/src/main.c @@ -43,8 +43,8 @@ int main(void) { // Calculate half of `num' mpz_fdiv_q_ui(halfNum, num, 2); // Loop through found primes - // Skip 2 because we're skipping even nymbers - for(ulli i = 1; mpz_cmp(primes.list[i], halfNum) >= 0; ++i) { + for(ulli i = 0; i < primes.end; ++i) { + if(mpz_cmp(primes.list[i], halfNum) >= 0) break; // If `num' is divisible by a prime then go to the next number if(mpz_divisible_p(num, primes.list[i]) != 0) goto nextPrime;