🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Because primes are always odd
  2. B.Divisors come in pairs d × e = n, and the smaller one of each pair is at most √n
  3. C.Because larger divisors do not exist
  4. 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 →