How Long Will Your Smartphone Distract You From Family Dinner?

A FiveThirtyEight Riddler puzzle.

By Vamshi Jandhyala in mathematics Riddler

December 22, 2015


You’ve just finished unwrapping your holiday presents. You and your sister got brand-new smartphones, opening them at the same moment. You immediately both start doing important tasks on the Internet, and each task you do takes one to five minutes. (All tasks take exactly one, two, three, four or five minutes, with an equal probability of each). After each task, you have a brief moment of clarity. During these, you remember that you and your sister are supposed to join the rest of the family for dinner and that you promised each other you’d arrive together. You ask if your sister is ready to eat, but if she is still in the middle of a task, she asks for time to finish it. In that case, you now have time to kill, so you start a new task (again, it will take one, two, three, four or five minutes, exactly, with an equal probability of each). If she asks you if it’s time for dinner while you’re still busy, you ask for time to finish up and she starts a new task and so on. From the moment you first open your gifts, how long on average does it take for both of you to be between tasks at the same time so you can finally eat? (You can assume the “moments of clarity” are so brief as to take no measurable time at all.)


from random import randrange
from itertools import accumulate

def break_points():
    return set(accumulate([randrange(1, 6) for _ in range(100)]))

runs = 10000
s_runs, total_t = 0, 0
for _ in range(runs):
    brother, sister = break_points(), break_points()
    common_points = brother.intersection(sister)
    if common_points:
        total_t += min(common_points)
        s_runs += 1