24

My alarm clock has a typical 7-segment digital display showing hours and minutes.

4:13

Every lit segment is equally bright, and every unlit segment is equally dark. The separator (:) is always lit.

12:05

Assuming the clock uses 12-hour time without a leading zero for the hours, at what time does the overall brightness (i.e., the total number of lit segments) of the display change the most?

zennehoy
  • 635
  • 5
  • 7

3 Answers3

21

Logic behind the answer:

The biggest change in brightness is: 7->8 (+4), 0->1 (-4), 1->2 (+3), 6->7 (-3).
Changing time by "tens," the greatest increase is from :19->:20 (+4), which is better than any single digit change.
An hour change (:59->:00) results in +1 brightness, so it is "inefficient" to go down in brightness (change in a single digit, 6->7, is less than :19->:20, and going from 6:59->7:00, is only a change of (-1)). So we are looking for an increase in brightness.

So, without really looking at anything else, my initial guess is:

7:59->8:00

resulting in:

+5 brightness

Note:

There is no lateral thinking tag, but when the clock is at 8:08, unplugging it results in a change of (-20) which is a greater change than (+6).

Edit:

Nine is 6 digits, not 5 like I originally thought.

eye_am_groot
  • 2,356
  • 8
  • 19
  • That "initial guess" looks good, but the math is off...ROT13(qbhoyr-purpx gur erfhyg bs mreb gb bar naq svsgl-avar gb mreb) – zennehoy Oct 24 '18 at 11:35
  • @zennehoy ROT13(vf avar 5 be 6 havgf)? – eye_am_groot Oct 24 '18 at 11:38
  • 1
    ROT13(avar vf fvk frtzragf) – zennehoy Oct 24 '18 at 11:39
  • @zennehoy ahh. I corrected – eye_am_groot Oct 24 '18 at 11:42
  • Some googling later I found there actually are clocks with 5-segment nines... Can't remember ever having seen one in real though. Thanks for updating your answer! – zennehoy Oct 24 '18 at 11:46
  • To be honest, I didn't look it up and just assumed that it was 5 not 6. But you are right, most are 6 :-) – eye_am_groot Oct 24 '18 at 11:47
  • @zennehoy: There are two common styles for each of 6, 7, and 9. Displays which are used to show hex need the crossbar on the 6 to distinguish it from "b". Digital clocks and watches often wire the top and bottom of the ten-minute segment together (the top, middle, and bottom segments all switch together for all digits except 4, 7, and possibly 6 and 9). While that wouldn't affect how 6 and 9 are displayed, I think the electronics worked out most simply to make 4 and 7 be the only two exceptions to treating all three segments as a unit. Incidentally, if one doesn't mind having... – supercat Oct 24 '18 at 16:05
  • ...a slightly weird 0 and a weirder 4, one could construct a display with different arrangement of 7 segments such that every digit would differ from every other by at least two segments. Three segments would be the top, right, and bottom of a box, and the other four would be radii from the center to the corners. In the common design, a six-segment 6 or 9 is only one segment different from 8, a three-segment 7 is only one segment different from 1, a normal four-segment 7 would be only one segment different from a five-segment 9, and an alternative four-segment 7 only one different from a 2. – supercat Oct 24 '18 at 16:10
7

The answer has already been given, but I show my approach how to get there, just a simple bash script brute-forcing all possibilities:

#!/bin/bash
brightness(){
    local b=0 c
    for ((c=0;c<${#1};c++)); do
    case ${1:$c:1} in
        0) (( b+=6 )); ;;
        1) (( b+=2 )); ;;
        2) (( b+=5 )); ;;
        3) (( b+=5 )); ;;
        4) (( b+=4 )); ;;
        5) (( b+=5 )); ;;
        6) (( b+=6 )); ;;
        7) (( b+=3 )); ;;
        8) (( b+=7 )); ;;
        9) (( b+=6 )); ;;
    esac
done
echo $b
}
biggest_diff=0
bbefore=$(brightness 1159)
for h in {0..11}; do
for m in {00..59}; do
    bnow=$(brightness $h$m)
        diff=$(( bnow - bbefore ))
    if [ ${diff#-} -ge $biggest_diff ]; then
        biggest_diff=${diff#-}
            echo Diff: $diff
        echo Time: $h:$m
    fi
    bbefore=$bnow
    done;
done

Calling it returns ...

./clock | tail -n2

Diff: 5
Time: 8:00

pLumo
  • 171
  • 3
  • +1 Nice one. Well, your script is short enough to not have side effects. Nevertheless, it would be nicer to declare function-wide variables local. Just write local c b=0 to declare c before the loop, and declare and assign c. – rexkogitans Oct 25 '18 at 07:01
  • true, edited ... – pLumo Oct 25 '18 at 07:52
4

Well, it is

+5 brightness from:
7:59 to 8:00

Since:

total of 7:59 is 3 + 5 + 6 = 14
total of 8:00 is 7 + 6 + 6 = 19

Ahmed Ashour
  • 998
  • 1
  • 7
  • 13