Welcome to The Riddler. Every week, I offer up a problem related to the things we hold dear around here — math, logic and probability. These problems, puzzles and riddles come from lots of top-notch puzzle folks around the world, including you, the readers. You’ll find this week’s puzzle below.

Mull it over on your commute, dissect it on your lunch break, and argue about it with your friends and lovers. When you’re ready, **submit your answer using the form at the bottom**! I’ll reveal the solution next week, and a correct submission (chosen at random) will earn a shoutout in this column. Important small print: If you want to be eligible for the shoutout, I need to receive your correct answer before midnight EST tonight. Speed is prized around here, but so is considered thought.

Before we get to the new puzzle, let’s dwell on last week’s! Congratulations to 👏 **Andrew Flack** 👏 of Alexandria, Virginia, our big winner. You can find a full solution to the previous Riddler at the bottom of this post.

Now, here’s this week’s Riddler, which comes to us from **James McTeague**, who works in tech support in Providence, Rhode Island:

The new year is nearly here, so let’s dive into calendar math!

Calendars are as predictable as the march of time itself — the major thing that changes is the day of the week a date is on. Jan. 1 was a Thursday in 2015, for example, but in 2016 it will be a Friday, requiring a one-day shift and making 2015’s calendar pretty useless.

Calendars’ predictability makes them ripe for mathy questions. Here are six to chew on:

- How many different calendars would you need to represent all possible years — accounting for all day and date combinations? (Don’t forget about leap years!)
- Now that we have all the calendars we could possibly need, it’d be nice to know how often we’re using them. When is the next time we’ll use the 2015 calendar?
- What is the smallest total number of years that will pass between using the same non-leap-year calendar twice?
- What is the largest?
- What is the smallest total number of years that will pass between using a leap year calendar twice?
- What is the largest?

Need a hint? You can try asking me nicely. Want to submit a puzzle or problem? Email me.

*Note: The Riddler will return to Friday next week. Happy New Year!*

[googleapps domain=”docs” dir=”forms/d/1oBs9EKA3LXKz8BRIDGeNAW6IB2_cHBmwjBzRtmHhCTw/viewform” query=”embedded=true” width=”760″ height=”1110″ /]

And here is the full solution to last week’s Riddler, which was about how long your smartphone would keep you from a family dinner, **courtesy of Olivia Walch**. My best Christmas gift this year: A record 50.9 percent of those of you who responded submitted a correct answer!

Here’s Olivia:

One useful way to see the math here is to consider a more general version of the problem, one with the same rules but fewer details. Imagine you and your sister are always on your phones doing one task after another, each of which takes some quantity of minutes, anywhere from 1 to … well, let’s just call this number \(\)\(n\). While you do this, there’s no talking, no other activities — in other words, a normal Thursday night. You still have instantaneous moments of clarity between tasks, but you don’t have a special holiday dinner to get to, so if you happen to sync up your own *moment of clarity* with your sister’s (which occurs occasionally), nothing happens, and you each just start again. Let’s call these synchronized moments of clarity *sync points*.

Now, convince yourself that the answer to the original puzzle is simply the average amount of time between sync points in this more general scenario. To find that out, we need to know the average frequency of sync points, or number of sync points per minute. The probability of a sync point at any given minute is the probability that you’re having a moment of clarity at that minute multiplied by the probability that your sister is having a moment of clarity.

Because the average time between your moments of clarity is \((n + 1)/2\), the probability that a *given* minute is a moment of clarity for you is the inverse of that, or \(2/(n + 1)\), and the same goes for your sister. (Put another way, the longer the average time between moments of clarity, the lower the probability that any given minute will be one.) Since they’re independent, we can multiply those two probabilities, for you and your sister, together and find that the frequency of sync points in the alternate universe is \((2/(n + 1))^2\).

With an average frequency of \((2/(n+1))^2\) sync points per minute, the average time between them will be \(((n+1)/2)^2\) minutes, and this carries back over to our scenario outlined last week. So the average amount of time you have to wait for \(n=5\) is \(((5+1)/2)^2=\) **9 minutes**.

Personally, a more realistic upper bound for my tasks these days is around \(n=15\) minutes. That means the expected wait time before my sister and I can do anything together is 64 minutes, which feels about right. Sorry, family!!

*Note: Other intrepid Riddler solvers turned to programmatic solutions. This, for example, is the code submitted by Andrew Flack.*

# R script run_simulation <- function(nsim = 1000) { result <- rep(NA, nsim) for (i in 1:nsim) { # simulate 100 tasks for sister a and sister b # keep track of the cumulative time at completion of each task a <- cumsum(sample.int(5, 100, TRUE)) b <- cumsum(sample.int(5, 100, TRUE)) # when their cumulative times match, they can go to dinner result[i] <- min(b[match(a, b)], na.rm = TRUE) } return(mean(result)) } run_simulation(1000000)