Can You Hand Out All The Candy?

Illustration by Guillaume Kurkdjian
Welcome to The Riddler. Every week, I offer up problems related to the things we hold dear around here: math, logic and probability. Two puzzles are presented each week: the Riddler Express for those of you who want something bite-size and the 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 the next column. Please wait until Monday to publicly share your answers! If you need a hint or have a favorite puzzle collecting dust in your attic, find me on Twitter or send me an email.
Riddler Express
From Irwin Altrows comes a “high-speed” express:
The winner of a particular baseball game will be determined by the next pitch. The pitcher will either throw a fastball or an offspeed pitch, while the batter will similarly be anticipating a fastball or an offspeed pitch. If the batter correctly guesses the pitch will be a fastball, they have a 1-in-5 chance of hitting a home run. If the batter correctly guesses the pitch will be offspeed, they have a 1-in-2 chance of hitting a home run. But if the batter guesses incorrectly, they will strike out and lose the game. (The batter is guaranteed to swing either way.)
To spice things up, the pitcher truthfully announces the probability with which they will throw a fastball. Then the batter truthfully announces the probability with which they will anticipate a fastball.
Assuming both pitcher and batter are excellent logicians, what is the probability that the batter will hit a home run?
Riddler Classic
For Halloween this year, you have purchased 150 pieces of candy. However, you’re not sure how many trick-or-treaters will visit you. Based on previous years, it could be anywhere from 50 to 150 (inclusive), with each number being equally likely.
As the trick-or-treaters arrive, you can decide to give each of them one, two or three candies. You want to avoid running out of candy, but you also want to avoid having any candy left over. Let X represent the number of trick-or-treaters who won’t get candy (if you do run out) or the number of leftover pieces (if you don’t run out).
This year, the day before Halloween, you come up with a strategy to minimize the expected value of X. What is this minimum expected value?
Solution to last week’s Riddler Express
Congratulations to ÐÃÂЯСÐß Christian Wolters ÐÃÂЯСÐß of San Jose, California, winner of last week’s Riddler Express.
Last week, my son noticed that when he held a fidget spinner in front of a television (with a 60 hertz refresh rate) and gave it a whirl, it appeared to suddenly spin backward a few times before coming to a halt. While many fidget spinners have three lobes, this particular spinner had five lobes, as shown below.

After giving it a spin, we clearly saw it spin backward three times before it stopped. How fast could it have been spinning at the beginning?
As stated in the problem, the television’s refresh rate was 60 hertz, so you could think of the spinner as having 60 snapshots taken per second. Now, what happened when the spinner was turning at exactly 12 revolutions per second (or 720 revolutions per minute)? Since 12 was one-fifth of 60, that meant the fidget spinner made one-fifth of a complete rotation for every snapshot. In other words, each lobe rotated from its current position to the position of the next lobe. In front of the television, the spinner appeared to be stationary!
As the spinner slowed to a halt (due to friction) and passed 12 revolutions per second, each lobe no longer made it all the way to the next lobe’s position with each snapshot, which made the spinner appear to spin backward. By the way, this is closely related to the wagon-wheel effect, where wheels caught on camera appear to spin backward when they’re actually spinning forward.
Not only did this backward motion appear to occur at speeds just below 12 revolutions per second, but it also occurred for speeds that were slightly less than integer multiples of 12 revolutions per second. For my son to have seen the effect occur three times, that meant the initial speed of the fidget spinner had to have been between 36 and 48 revolutions per second.
If you’re still not convinced, here’s an animation of a spinner that starts at 45 clockwise revolutions per second and slows down to zero, with 60 snapshots taken per second — all slowed down for the purposes of visualization, of course. As you can see, at speeds just below 36, 24 and 12 revolutions per second, the lobes appear to spin backward for a brief period of time.

For extra credit, you were presented with some additional information. Upon closer examination, my son saw the spinner go backward another three times, but in these cases, it appeared to have twice as many lobes (i.e., 10). Now, how fast could it have been spinning at the beginning?
We already said that the spinner appeared to go backward when the speed was slightly less than integer multiples of 12 revolutions per second. But what happened at half-integer multiples? For example, when the speed was 6 revolutions per second, every other snapshot appeared to be in the same position, while the remaining snapshots were halfway between. This made the spinner appear to have 10 lobes rather than five. And as the spinner slowed down past these half-integer multiples, the 10 lobes again appeared to spin backward. If you look closely, you can see these backward spins around the half-integer multiples of 12 revolutions per second in the above animation.
And so the answer to the extra credit was that the spinner’s initial speed was between 30 and 42 revolutions per second. The speeds at which there appeared to be 10 backward-moving lobes were just below 30, 18 and 6 revolutions per second.
By the way, if you want to see a real recording of this phenomenon, albeit for a three-lobed fidget spinner, check out this video from reader Danny Sleator.
Solution to last week’s Riddler Classic
Congratulations to ÐÃÂЯСÐß Sanandan Swaminathan ÐÃÂЯСÐß of San Jose, California, winner of last week’s Riddler Classic.
Last week, a thousand people were playing Lotería, also known as Mexican bingo. The game consisted of a deck of 54 cards, each with a unique picture. Each player had a board with 16 of the 54 pictures, arranged in a 4-by-4 grid. The boards were randomly generated, such that each board had 16 distinct pictures that were equally likely to be any of the 54.
During the game, one card from the deck was drawn at a time, and anyone whose board included that card’s picture marked it on their board. A player won by marking four pictures that formed one of four patterns, as exemplified below: any entire row, any entire column, the four corners of the grid and any 2-by-2 square.

After the fourth card had been drawn, there were no winners. What was the probability that there would be exactly one winner when the fifth card was drawn?
Before getting into the specifics of Lotería, suppose the probability that one particular person won on the fifth draw given that they didn’t win in the first four draws was p. Then the probability that this particular person would have been the only winner among the thousand was pÑÃâÐÃËЩ(1−p)999. That was the same probability for another player being the only winner, and another — and for all thousand players, as a matter of fact. So the probability that anyone was that lone winner was 1,000ÑÃâÐÃËЩpÑÃâÐÃËЩ(1−p)999.
At this point, we still had to determine the value of p. Solver Max Candocia did this by first recognizing that there were 54 choose 5 ways to select the first five cards. Of these, 18ÑÃâÐÃËЩ50, or 900, resulted in a victory for a particular board. The 18 came from the fact that there were 18 winning patterns in total (four rows, four columns, one set of corners, and nine 2-by-2 squares), while the 50 came from the fact that the one card not involved in the winning pattern could have been any of the remaining 54−4, or 50, cards.
However, 20 percent of the time, these five-card sets resulted in victory after only four cards had been drawn — that is, when that unhelpful card happened to be drawn fifth from the deck. That meant p was equal to 0.8ÑÃâÐÃËЩ18ÑÃâÐÃËЩ50/(54 choose 5), or about 0.0002277. Plugging this back into the previous expression, the probability of having exactly one winner on the fifth draw (given no winners after four draws) was approximately 18.1 percent.
Solver Laurent Lessard went a step further, solving the general case for when there were N distinct cards in the deck (i.e., not necessarily 54) and M people playing (i.e., not necessarily 1,000). Laurent found a quartic relation (because four cards, of course!) between M and N that maximized the likelihood of having a single winner when the fifth card was drawn. This quartic relation is plotted below:
Want more puzzles?
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 Zach Wissner-Gross at riddlercolumn@gmail.com.