“Overcoming jet lag is fundamentally a math problem and we’ve calculated the optimal way of doing it,” says math professor Danny Forger, according to a University of Michigan press release. “We’re certainly not the first people to offer advice about this, but our predictions show the best and quickest ways to adjust across time zones.”

Entrain app screen shot. Credit: U. of Michigan.

Forger and graduate student Kirill Serkh created an iPhone app, based on their research recently published in PLoS Computational Biology, that helps travellers sync their bodies when jetting across time zones.

The problem when jetting around the globe and disrupting your internal clock is, well, your internal clock—circadian rhythms. Those 24-hour cycling rhythms guide not only when we sleep and eat, but also the very molecular processes happening inside each of our cells. Circadian rhythms are thought to be largely regulated by sunlight, so adapting light schedules can help get cells adjust to time zone jolts more rapidly.

The app, called Entrain, features customizable light schedules that you can follow to help sync your circadian rhythms with the current time zone. The app tells you particular blocks of time when you should expose yourself to bright light or seek darkness to help get your cells back on track.

And the secret behind this schedule? Math.

The researchers, along with app builder and mathematics graduate student Olivia Walch, used two mathematical models of circadian rhythms to optimize traveller’s light schedules.

The app even predicts how long it will take your body to adjust to the time difference if following the prescribed light schedule, making planning your trip and activities more manageable when jetting around the globe.