ProgrammingVery hard
How many integers from 1 to 10^9 are divisible by 7 or by 11?
- A. 220779220
- B. 220779221
- C. 142857142
- D. 90909090
Correct answer: A. 220779220
Inclusion-exclusion gives floor(N/7) + floor(N/11) - floor(N/77) = 142857142 + 90909090 - 12987012 = 220779220.
More C Programming questions
- The modular inverse of 2 modulo the NTT prime 998244353 is which value?
- A linear congruential generator x = (1103515245 x + 12345) mod 2^31 starts with x = 1. What is the next value?
- With 64-bit arithmetic, what is (10^9 x 10^9) mod (10^9 + 7)?
- What is the value of x & (x - 1) for x = 0b10110100 in binary as a decimal?
- How many integers in the range 0 to 255 have both bit 7 and bit 0 set?
- What is the number of trailing zero bits in 40 (binary 101000)?