# Dark time in prison

You wake up. It is pitch dark. You don't know where you are. You feel groggy.

The last thing you remember is being in a bar, a sexy young woman appeared out of nowhere, walked straight at you, smiled, engaged conversation and offered you a drink. You should have known things don't happen like that. You should have been suspicious when she complimented your outfit and started to laugh at your math jokes. Anyway.

You must have been kidnapped. Now you are in a prison cell or something, behind bars. It is pitch dark.

You wonder what time it is. Is it day or night? You have no idea. There are no windows.

You don't wear watches any more. But you still lift your wrist. Old habit. Anyway it's pitch dark, you don't see anything. And your smartphone has been taken away.

You just sit there and look into the darkness. Did I mention? It is pitch dark.

Then you notice, outside of the cell, there is a faint reddish glow changing slightly every second. There must be a digital clock on the wall, but invisible from where you are. The kind with luminous 7-segment digits.

You are bored. And you really want to know what time it is.

The faint glow changes slightly every second. It must be the number of segments that are lit at any time. Sometimes it doesn't change. You can't tell exactly how much it changes or how it compares to a few seconds ago. You only see whether it gets brighter or dimmer. Every second. Mesmerizing.

You realize you probably can read the time from that.

The question: Is it possible to eventually know the time from the changes in the reddish glow? If yes, how long will it take in the worst case to be certain what time it is?

Assume 24 hour format. But does it display a leading zero on hours? You are not supposed to know. How would you, right?

21 hours

the second indicator triggers -+0-++-+-?, where ? is the varying change of light at a 10 second change.
The ++ sequence give the 10 second boundary in ten seconds, and the occurred ? i.e. 10 second boundary i.e. second digit is known.
the 10-second indicator triggers -+0-+? , where ? is the minute change. This since (even) the seconds indicator does not change light at 9->0.
The change on a minute boundary can be not be zero 2 times in a row (only at hour changes or minute 2 to 3 changes) So in 2 minutes+1 second we have identified the minute boundary/10second digit
Note that 59 to 00, increases the light by one, so
the minute indicator will trigger -++0++-+0?, with an unique ++0 sequence; the 10 minute indicator will be -++0+? with an unique ++0 sequence; the hour indicator will trigger -+++++-++?, with an unique +++++ sequence. So 1 cycle will be (more than) enough for those digits -> all but the 10hour digit are certainly known in 10 hours+1 second.
Hour changes occur in the order:
A -+++++-++ B -+++++-++ + -++
with {A,B} either {-,+} or {0,-}
focusing on the +++++ there are two sequences
+ +++-++B- +++++ -+++-++ A (B could be -)
- +++-++A- +++++ -++B-++ + {A,B} can be {-,+}
only the first and last are guaranteed to be different, so at least 21 hourly changes are needed
21 changes will include such a sequence of +++++; thus 21 changes i.e. 21 hour is enough

• When you say: "6 and 0 have the same dimness", are you sure these are the digits you want to compare? Commented Sep 3, 2022 at 11:35
• Fixed the use of 6 iso 5(9) Commented Sep 3, 2022 at 12:38
• Did you consider that you don't know whether there is a leading zero and you need to figure that out? Commented Sep 3, 2022 at 15:15
• Yes. Therefor the ? ? at the end of the text and "the longest ... (if leading zeros are not present)" I did not explicitly say/prove that if they are present the time will be known faster, but implicitly it should be understood that then the longest twice occurring sequence is shorter Commented Sep 3, 2022 at 15:25
• What you have shown is that if you are told there are no leading digits then it will take longer than if you are told there are leading digits. Commented Sep 3, 2022 at 15:32

Assumptions:

• Brightness depends on number of segments lit, regardless of which ones. (More = brighter, fewer = dimmer, same number = same brightness.)
• The clock display is accurate at all times, but it may be 12- or 24-hour, and may or may not have leading zeroes in each segment.

As the last digit cycles around, the segment count changes as follows:

0 to 1 -> -4

1 to 2 -> +3

2 to 3 -> +0

3 to 4 -> -1

4 to 5 -> +1

5 to 6 -> +1

6 to 7 -> -3

7 to 8 -> +4

8 to 9 -> -1

9 to 0 -> +0, but also at least one of the other digits also changes

I suspect there's enough information to eventually know the time.

I don't have the patience to work out the worst case, but it's at least 12 hours. (It might have started at 1:00:00, in which case a 12- and 24-hour clock would be identical until after 12:59:59.)

• Actually, I excluded the 12h clock because that would mean you will never know whether it is day or night. But you are thinking in the right way. Commented Sep 3, 2022 at 3:58