Navigating the culinary landscape of an unfamiliar city presents a classic conundrum: do you chase new dining experiences every evening, or settle into a beloved spot and order the same thing until you have to go home? Researchers have now revealed that the legendary physicist and Nobel laureate Richard Feynman cooked up a mathematical solution to this dilemma - provided you know the full menu of options. And it turns out humans may already be using a similar heuristic, albeit without the equations.

"The essence of the problem is that the value of exploring, of looking around and trying something new, decreases the opportunities you’re going to have to make use of that information," said Prof Tom Griffiths of Princeton University, co-author of the study published in the Proceedings of the National Academy of Sciences. The team notes that the restaurant dilemma is a specific flavor of the "stopping problem" - deciding when to end one activity and begin another.

Feynman's interest was apparently piqued during a lunch with his friend Ralph Leighton at a Thai restaurant in California in the 1970s. Leighton was agonizing over whether to order his usual ginger chicken or venture into uncharted menu territory. Feynman, being Feynman, turned this into a mathematical problem, scribbling notes that remained "inscrutable for decades" until Griffiths and his team deciphered them.

Rather than focusing on individual dish selection, the researchers reframed the problem: how many nights should you try a different restaurant in a city you're visiting for a fixed number of days? Feynman's solution dictates that you should sample new restaurants until you find one that exceeds a certain quality threshold. That threshold, however, isn't fixed - it declines more and more rapidly as your remaining days shrink. In plain English: the less time you have left, the less incentive you have to keep hunting for the perfect pad thai, because you won't have many nights to enjoy it.

"The thresholds are being guided by the best thing you might be able to find if you kept looking," said Griffiths. "If you have a long time to look, finding something amazing has a lot of value because you can go back many times."

The model assumes restaurants are uniformly distributed across a quality spectrum, but the researchers also considered non-uniform scenarios. If a city has many terrible restaurants and a few gems, the threshold starts higher - meaning you should explore longer. If most restaurants are decent but unspectacular, the threshold is lower, and you can settle down sooner.

Griffiths and co-author Brian Christian from the University of Oxford first tackled Feynman's conundrum over a decade ago, but their new work also includes a behavioral experiment. They recruited 2,520 participants to play an online game where they imagined visiting a city for varying lengths of time, with different distributions of restaurant quality. Participants were shown a grid of squares - each representing a restaurant - and had to pick one per day, revealing its quality after selection.

The results showed that people didn't follow Feynman's exact formula. Instead, their threshold decreased linearly with the proportion of nights remaining. "It's a little bit simpler than Feynman's solution, but it actually turns out to be quite good," said Griffiths. "The trick is having a threshold and then decreasing that threshold as you get closer to the end [of a trip]. And as long as you are doing something like that, that'll actually work pretty well."

So next time you're in a new city and find yourself staring at a menu for the third night in a row, take comfort: you're not being lazy, you're being mathematically optimal.