Organize Some Debates! Maximize The Shade!

Welcome to The Riddler. Every week, I offer up problems related to the things we hold dear around here: math, logic and probability. There are two types: Riddler Express for those of you who want something bite-size and Riddler Classic for those of you in the slow-puzzle movement. Submit a correct answer for either,1 and you may get a shoutout in next week’s column. If you need a hint or have a favorite puzzle collecting dust in your attic, find me on Twitter.

## Riddler Express

From Dave Moran, a debate dilemma:

There are 20 candidates running for the presidential nomination of the Puzzle Party, and the Puzzle Party National Committee is organizing a series of debates. The number of candidates is too big for all of them to appear on the stage at once, so the PPNC splits them for each debate into panels of 10.

In the first round, Candidates 1 through 10 appear together and Candidates 11 through 20 appear together. There’s just one rule: the candidates can only critique someone they share the stage with. Therefore, Candidates 1 through 10 can throw shade at each other but not at candidates 11 through 20 — and vice versa. However, the PPNC is keen on shade and wants to remedy this problem by mixing up the panels in subsequent debates.

What is the minimum number of rounds of bifurcated 10-candidate debates such that each candidate gets an opportunity to personally attack every other candidate?

## Riddler Classic

From Erich Friedman, a board exam:

You are the proud owner of a circular pond with a radius of 1 yard. You are also the proud owner of a large collection of thin boards that are each exactly 1 yard long. By placing these boards one by one, so that the ends of each lie on either the banks of the pond or on another previously placed board, how many boards are necessary to cover the center point of the pond with a board?

For example, the solutions for smaller ponds with radii 1/2 yard, 5/8 yard and slightly more than 7/10 yard are shown below:

## Solution to last week’s Riddler Express

Congratulations to 👏 Stephen Haas 👏 of Santa Clara, California, winner of last week’s Riddler Express!

Last week brought a little bit of number theory, in the form of this sequence:

1111211121212211212221212121…

Your job was to figure out what number came next.

That number was 3. These numbers are the numbers of distinct prime numbers that divide 2, 3, 4, 5, 6, 7, 8 and so on.

For example, 2 is divided by the single prime number 2, hence the number 1 to begin our sequence. Similarly, 3 is divided by 3 alone, 4 is divided by 2 alone, and 5 is divided by 5 alone — so the first four numbers of our sequence are 1. The number 6, however, is divided by 2 and 3 — two distinct primes — so its entry in our sequence is 2.

On we go like that until we reach the end of what was given, at which point we should consider the distinct prime divisors of the number 30. It is divided by the three primes: 2, 3 and 5. So its entry — and the correct solution — is 3.

## Solution to last week’s Riddler Classic

Congratulations to 👏 Justin Pombrio 👏 of Somerville, Massachusetts, winner of last week’s Riddler Classic!

Last week you found yourself aboard a strange train with some unknown number of cars which connected to form a circle. You could walk between the cars and therefore, if you walked far enough, you’d end up back in the car you started in. The cars were indistinguishable, but each had a single light that you could turn on or off. Each light in the train was initially set on or off at random. You were not allowed to deface or otherwise mark any car, and a car’s light was only visible from within that car — all you could do was walk around and flip light switches. What is the most efficient way to determine how many cars were on this train?

This puzzle’s submitter, Ben Tupper, created a helpful video describing his solution, which is built around a simple walking-and-flipping algorithm he calls check(n).

Essentially, check(n) checks whether the train has n or fewer cars — if the train does have fewer than n cars, we’ll know exactly how many cars it has. It works like this: First, turn on the light in the starting car. Second, walk in one direction through n more cars, turning all of their lights on if they aren’t already. Third, when you reach the nth car, turn off its light if it’s not off already. Fourth, walk back in the other direction to your starting car.

For example, say you performed check(9) on a train that happened to have eight cars. You walk through nine cars, turning on their lights, and in the process you’d walk past where you started, though you wouldn’t know it yet. You’d then turn off a car’s light and walk back to your starting car in the other direction. But on that walk, you’d enter a car where the light was off — this has to be the light that you yourself turned off. By counting your steps, you can determine the exact length of this train.

If a train has more than n cars, however, all we learn from check(n) is that the train has more than n cars. So the question of how to count the cars efficiently boils down to how we choose the number n.

One way would be to perform check(1), check(2), check(3), check(4), and so on, until we found the train’s length. This will definitely work, but it’s not efficient. The number of steps this would take increases exponentially as the length of the train increases. Determining the length of a 20-car train, for example, would take about 400 steps, and a 40-car train would take more than 1,600 steps.

But we can skip a lot of these checks to improve our efficiency. It is much better to perform check(1), check(2), check(4), check(8), and so on, until we find the train’s length. This way, a 20-car train can be unriddled in about 100 steps and a 40-car train in about 250 steps. The number of steps using this method increases linearly as the length of the train increases. (Ben suggests that you may even be able to improve slightly on this method, though still in linear time, by altering the direction of your walking in a clever way — you can find that description toward the end of his video.)

Who ever said the Riddler wasn’t practical? Who among us hasn’t been on a mysteriously long circular train? Well, now we know what to do. You’re welcome. Happy walking.

## Want more riddles?

Well, aren’t you lucky? There’s a whole book full of the best puzzles from this column and some never-before-seen head-scratchers. It’s called “The Riddler,” and it’s in stores now!

## Want to submit a riddle?

Email me at oliver.roeder@fivethirtyeight.com.

## Footnotes

1. Important small print: For you to be eligible, I need to receive your correct answer before 11:59 p.m. Eastern time on Sunday. Have a great weekend!

Oliver Roeder was a senior writer for FiveThirtyEight. He holds a Ph.D. in economics from the University of Texas at Austin, where he studied game theory and political competition.