To represent all integers from 0 to 10⁶ inclusive, we need at least 10⁶ + 1 distinct bit patterns. In binary, n bits can represent 2ⁿ distinct values, so we require 2ⁿ ≥ 10⁶ + 1. Since 2¹⁹ = 524288 < 10⁶ + 1 and 2²⁰ = 1048576 ≥ 10⁶ + 1, we must take n = 20. Therefore, 20 bits are the minimum needed, making option C correct.
Option A:
Option A, 19 bits, can represent only 524288 values, fewer than the 1,000,001 needed (0 through 10⁶). So it is insufficient.
Option B:
Option B, 18 bits, represents an even smaller range, so it cannot work.
Option C:
Option C is the smallest n with 2ⁿ ≥ 1,000,001, so it is minimal and correct.
Option D:
Option D, 21 bits, is sufficient but not minimal since 20 bits already cover the required range.
Comment Your Answer
Please login to comment your answer.
Sign In
Sign Up
Answers commented by others
No answers commented yet. Be the first to comment!