Sirui’s Sleep Algorithm


We’ve all encountered situations where we can’t get enough sleep. Say that a person named Messy normally sleeps at 12:00 am and wakes up at 8:00 am every day. But one day for some reason he messed it up; he slept at 3:00 am and woke up at 9:00 am. Since he slept 6 hours he was still tired after waking up, so he took a nap of 1 hour in the afternoon. Now, my question is when should he sleep on that day so that he will wake up at 8:00 am the next day feeling relaxed but not overslept? Or, what time should he sleep on that day so that his old schedule is restored?

I have developed an algorithm based on 8 hours of sufficient sleep each day.

To make it easy on you, I have made an Excel file to simplify your calculations. All you have to do is to enter the values and you’ll get the result.

The file is HERE.


The algorithm works as follows:

First let’s establish some values.

Time (24 hour) you got up today = Tg

Time (24 hour) you want to get up tomorrow = Tmg

Time (24 hour) you want to sleep tomorrow = Tml

How do you feel when you wake up? = Wuv (16 if feeling great, 14 if tired, 12 if very tired)

Nap (hour) you take today = Nap (0 if none)

Time (24 hour) you need to sleep today = X

X = (Wuv + Tg + 3*Tmg + 1.5*Nap – Tml + 48) / 3


For example, I slept at 3:00 am yesterday, and I woke up at 8:30 am today, feeling tired, so I took a 2 hour nap in the afternoon. My desire is to get up at 9:00 am tomorrow, but also be able to sleep at 23:00 tomorrow.

Tg = 8.5

Tmg = 9

Tml = 23

Wuv = –2

Nap = 2

X = (14 + 8.5 + 3*9 + 1.5*2 – 23 + 48) / 3

X = 25.833

It means that I should sleep at hour 25.833, which is 1:50 am tomorrow.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s