# King Arthur's knights

Computer Science Level 4

There are p knights sitting at positions $$[1, 2, ... p]$$ at King Arthur's round table. In order to choose the leader, Arthur starts counting at position 1 and dismisses every rth seated knight until only 1 knight remains. The remaining seated knight becomes the leader.

Let $$C(p, r)$$ be the integer position of the eventual leader when the table starts out with p knights and every rth seated one is dismissed.

Let T = $$C(999,11) + C(121, 12) + C(2, 1) + C(15, 16) + C(99, 3)$$. What is T?

Details and assumptions

$$C(4, 2) = 1$$. The knights start seated at positions 1, 2, 3, 4. Arthur dismisses them in this order: 2, 4, 3. The knight seated at position 1 becomes the leader.

×