ProgrammingVery hard
The modular inverse of 3 modulo 1000000007 is which value?
- A. 333333335
- B. 333333337
- C. 333333336
- D. 666666670
Correct answer: C. 333333336
Fermat's little theorem gives 3^(p-2) mod p = 333333336, and 3 x 333333336 = 1000000008 = 1 (mod p).
More C Programming questions
- Which expression is correct for (a b) % MOD with MOD = 1000000007 and 0 <= a, b < MOD, to avoid overflow in C?
- How many times does the loop x &= x - 1 run for x = 0b101100 before x becomes 0?
- For unsigned x = 40 (binary 101000), what is x & -x?
- Reversing the 8 bits of 0b00010110 gives which value in decimal?
- The Gray code of 5 (binary 101), computed as n ^ (n >> 1), is which value?
- What is the parity of the number of set bits in 0b1011, so that the result is 1 when odd?