← Quiz: Number Theory for Coding: all 10 questions
Quiz: Number Theory for Coding · Question 4 of 10
In the Sieve of Eratosthenes, why start crossing out multiples of p from p × p?
In the Sieve of Eratosthenes, why start crossing out multiples of p from p × p?
- A.Smaller multiples of p have a smaller prime factor and were already crossed out
- B.Because p × p is always prime
- C.To save memory
- D.Because 2p is never a multiple of p
Answer & explanation
Correct answer: Smaller multiples of p have a smaller prime factor and were already crossed out
For example 3 × 5 = 15 was already removed by 3 before we reach 5.
Can you get the rest right without peeking?
Take the timed Quiz: Number Theory for Coding quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →