🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Number Theory for Coding: all 10 questions

Quiz: Number Theory for Coding · Question 7 of 10

Why do problems often ask for the answer modulo 10⁹ + 7?

Why do problems often ask for the answer modulo 10⁹ + 7?

  1. A.Because it makes the answer always even
  2. B.Because it is the largest prime
  3. C.Because it is required by Java
  4. D.The true answer is huge; 10⁹ + 7 is prime and products of two values below it fit in 64 bits
Answer & explanation

Correct answer: The true answer is huge; 10⁹ + 7 is prime and products of two values below it fit in 64 bits

Being prime also lets you divide using the modular inverse.

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 →