← Quiz: Number Programs in C: all 10 questions
Quiz: Number Programs in C · Question 4 of 10
In a prime check, why is it enough to test divisors d while d d <= n?
In a prime check, why is it enough to test divisors d while d * d <= n?
- A.Because primes are always odd
- B.Divisors come in pairs d × e = n, and the smaller one of each pair is at most √n
- C.Because larger divisors do not exist
- D.To avoid integer overflow
Answer & explanation
Correct answer: Divisors come in pairs d × e = n, and the smaller one of each pair is at most √n
If no divisor up to √n exists, there is no larger one either, since its partner would be smaller than √n.
Can you get the rest right without peeking?
Take the timed Quiz: Number Programs in C quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →