Correct answer: C. p = 2^k − 1 and 0 ≤ k ≤ m
At each guard test p = 2⁰ + … + 2^(k−1) = 2^k − 1 (k = 0 gives p = 0). The guard is also evaluated one last time with k = m, so the bound must be 0 ≤ k ≤ m.
Note on the official key: the official key says option B. Official key gives (B), but p = 2^(k+1) − 1 already fails at the start (k = 0, p = 0), and k < m fails on the last guard test when k = m.
Open this question →