Made a fix, because previously it was not measuring primes.
This commit is contained in:
		@@ -43,8 +43,8 @@ int main(void) {
 | 
				
			|||||||
		// Calculate half of `num'
 | 
							// Calculate half of `num'
 | 
				
			||||||
		mpz_fdiv_q_ui(halfNum, num, 2);
 | 
							mpz_fdiv_q_ui(halfNum, num, 2);
 | 
				
			||||||
		// Loop through found primes
 | 
							// Loop through found primes
 | 
				
			||||||
		// Skip 2 because we're skipping even nymbers
 | 
							for(ulli i = 0; i < primes.end; ++i) {
 | 
				
			||||||
		for(ulli i = 1; mpz_cmp(primes.list[i], halfNum) >= 0; ++i) {
 | 
								if(mpz_cmp(primes.list[i], halfNum) >= 0) break;
 | 
				
			||||||
			// If `num' is divisible by a prime then go to the next number
 | 
								// If `num' is divisible by a prime then go to the next number
 | 
				
			||||||
			if(mpz_divisible_p(num, primes.list[i]) != 0)
 | 
								if(mpz_divisible_p(num, primes.list[i]) != 0)
 | 
				
			||||||
				goto nextPrime;
 | 
									goto nextPrime;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user