How many times can you add up the digits?

This week’s Fiddler is a puzzle about adding digits over and over again.

For any positive, base-10 integer $n$, define $f(n)$ as the number of times you have to add up its digits until you get a one-digit number. For example, $f(23) = 1$ because $2+3 = 5$, a one-digit number. Meanwhile, $f(888) = 2$, since $8+8+8 = 24$, a two-digit number, and then adding up those digits gives you $2+4 = 6$, a one-digit number. Find the smallest whole number $n$ such that $f(n) = 4$.

Extra Credit: For how many whole numbers $n$ between $1$ and $10,000$ does $f(n) = 3$?

My solution:
[Show Solution]

Making something out of nothing

This week’s Fiddler is a problem about composing functions. Here it goes:

Consider $f(n) = 2n+1$ and $g(n) = 4n$. It’s possible to produce different whole numbers by applying combinations of $f$ and $g$ to $0$. How many whole numbers between $1$ and $1024$ (including $1$ and $1024$) can you produce by applying some combination of $f$’s and $g$’s to the number $0$?

Extra Credit: Now consider the functions $g(n) = 4n$ and $h(n) = 1−2n$. How many integers between $-1024$ and $1024$ (including $-1024$ and $1024$) can you produce by applying some combination of $g$’s and $h$’s to the number $0$?

My solution:
[Show Solution]

Pill splitting

his week’s Riddler classic is about splitting pills to get the right dose.

I’ve been prescribed to take 1.5 pills of a certain medication every day for 10 days, so I have a bottle with 15 pills. Each morning, I take two pills out of the bottle at random.

On the first morning, these are guaranteed to be two full pills. I consume one of them, split the other in half using a precision blade, consume half of that second pill, and place the remaining half back into the bottle.

On subsequent mornings when I take out two pills, there are three possibilities:

  • I get two full pills. As on the first morning, I split one and place the unused half back into the bottle.
  • I get one full pill and one half-pill, both of which I consume.
  • I get two half-pills. In this case, I take out another pill at random. If it’s a half-pill, then I consume all three halves. But if it’s a full pill, I split it and place the unused half back in the bottle.

Assume that each pill — whether it is a full pill or a half-pill — is equally likely to be taken out of the bottle.

On the 10th day, I again take out two pills and consume them. In a rush, I immediately throw the bottle in the trash before bothering to check whether I had just consumed full pills or half-pills. What’s the probability that I took the full dosage, meaning I don’t have to dig through the trash for a remaining half-pill?

My solution:
[Show Solution]

Catch the grasshopper

This week’s Riddler classic is a probability problem about a grasshopper!

You are trying to catch a grasshopper on a balance beam that is 1 meter long. Every time you try to catch it, it jumps to a random point along the interval between 20 centimeters left of its current position and 20 centimeters right of its current position. If the grasshopper is within 20 centimeters of one of the edges, it will not jump off the edge. For example, if it is 10 centimeters from the left edge of the beam, then it will randomly jump to anywhere within 30 centimeters of that edge with equal probability (meaning it will be twice as likely to jump right as it is to jump left). After many, many failed attempts to catch the grasshopper, where is it most likely to be on the beam? Where is it least likely? And what is the ratio between these respective probabilities?

My solution:
[Show Solution]

Frustrating elevator

This weeks Riddler Express is a problem about a frustrating elevator! Here it goes:

You are on the 10th floor of a tower and want to exit on the first floor. You get into the elevator and hit 1. However, this elevator is malfunctioning in a specific way. When you hit 1, it correctly registers the request to descend, but it randomly selects some floor below your current floor (including the first floor). The car then stops at that floor. If it’s not the first floor, you again hit 1 and the process repeats.

Assuming you are the only passenger on the elevator, how many floors on average will it stop at (including your final stop, the first floor) until you exit?

My solution:
[Show Solution]

The luckiest coin

This week’s Riddler Classic is about finding the “luckiest” coin!

I have in my possession 1 million fair coins. I first flip all 1 million coins simultaneously, discarding any coins that come up tails. I flip all the coins that come up heads a second time, and I again discard any of these coins that come up tails. I repeat this process, over and over again. If at any point I am left with one coin, I declare that to be the “luckiest” coin.

But getting to one coin is no sure thing. For example, I might find myself with two coins, flip both of them and have both come up tails. Then I would have zero coins, never having had exactly one coin.

What is the probability that I will at some point have exactly one “luckiest” coin?

Here is my solution:
[Show Solution]

Vehicular trouble

This week’s Riddler Classic is about steady-state mixing of fluids. Here is the paraphrased problem.

Your old van holds 12 quarts of transmission fluid. At the moment, all 12 quarts are “old.” But changing all 12 quarts at once carries a risk of transmission failure. Instead, you decide to replace the fluid a little bit at a time. Each month, you remove one quart of old fluid, add one quart of fresh fluid and then drive the van to thoroughly mix up the fluid. Unfortunately, after precisely one year of use, what was once fresh transmission fluid officially turns “old.” You keep up this process for many, many years. One day, immediately after replacing a quart of fluid, you decide to check your transmission. What percent of the fluid is old?

Here is my solution:
[Show Solution]

Inscribed hexagons

This week’s Riddler Classic is a geometry problem involving inscribed hexagons.

The larger regular hexagon in the diagram below has a side length of 1. What is the side length of the smaller regular hexagon?
If you look very closely, there are two more, even smaller hexagons on top. What are their side lengths?

Here is my solution:
[Show Solution]

Optimal Wordle

This week’s Riddler Classic is about the viral word game Wordle.

Find a strategy that maximizes your probability of winning Wordle in at most three guesses.

Here is my solution:
[Show Solution]

Squid game

This week’s Riddler Classic is Squid Game-themed!

There are 16 competitors who must cross a bridge made up of 18 pairs of separated glass squares. Here is what the bridge looks like from above:

To cross the bridge, each competitor jumps from one pair of squares to the next. However, they must choose one of the two squares in a pair to land on. Within each pair, one square is made of tempered glass, while the other is made of normal glass. If you jump onto tempered glass, all is well, and you can continue on to the next pair of squares. But if you jump onto normal glass, it will break, and you will be eliminated from the competition.

The competitors have no knowledge of which square within each pair is made of tempered glass. The only way to figure it out is to take a leap of faith and jump onto a square. Once a pair is revealed — either when someone lands on a tempered square or a normal square — all remaining competitors take notice and will choose the tempered glass when they arrive at that pair.

On average, how many of the 16 competitors will make it across the bridge?

Here is my solution.
[Show Solution]

And here is a much better solution!
[Show Solution]