Midnight Pub

Staring at My Watch


The trains have been incredibly bad these past few weeks, a fact that makes me mourn even more the current loss of my bike, especially since the WiFi consistently isn't working meaning that there is very little for me to do except stare at my watch and sigh.

To decrease my alarmingly upsetting levels of boredom and my apathy for bureaucracy and people in general, I began to play with my watch on my phone and ponder:

    At what Time(s) are the Minute hand and Hour hand exactly 180°?


For example, at 6pm/6am, the hour hand is exactly facing down and the minute hand exactly facing up. What other instances of this are there?

I came up with two approaches, one brute force and the other more elegant.

1. The Brute Force Approach


(with-current-buffer (switch-to-buffer "*Messages*")
  (require 'cl)
  (let* ((required-angle-diff 180)
         (angle-precision 1)
         (minute-precision 0.01)
         ;; calc-once
         (angle-between-hours (/ 360 12))
         (all-mins (reverse (cdr (reverse (number-sequence 0 60 minute-precision)))))
         (all-hours (number-sequence 1 12)))
    (cl-labels ((angle-for-min (mins) (* 360 (/ mins 60)))
                (angle-for-hour (hour mins)
                                (let* ((start-hour-angle (* 360 (/ (float (mod hour 12)) 12)))
                                       (min-angle-suppl (* angle-between-hours (/ (float mins) 60))))
                                  (+ start-hour-angle min-angle-suppl)))
                (angle-in-range (diff-angle)
                                (and (> diff-angle (- required-angle-diff angle-precision))
                                     (< diff-angle (+ required-angle-diff angle-precision))))
                (diff-angle-hourmin (hour mins)
                                    (let* ((angle-min (angle-for-min mins))
                                           (angle-hour (angle-for-hour hour mins))
                                           (diff-angle (abs (- angle-hour angle-min))))
                                      (if (angle-in-range diff-angle)
                                          (cons (abs (- diff-angle required-angle-diff))
      ;; Brute force it
      (dolist (curr-hour all-hours)
        (setq hour-hit-min (cons 100 0))
        (dolist (curr-min all-mins)
          (let ((angle-hit (diff-angle-hourmin curr-hour curr-min)))
            (if angle-hit
                (if (< (car angle-hit) (car hour-hit-min))
                    (setq hour-hit-min
                          (list (car angle-hit) curr-min (cdr angle-hit)))))))
        (message "%02d:%02d:%02d - %.2f°"
                 (floor (cadr hour-hit-min))
                 (* 60 (- (cadr hour-hit-min) (floor (cadr hour-hit-min))))
                 (caddr hour-hit-min))))))


01:38:10 - 179.99°
02:43:38 - 180.02°
03:49:05 - 180.00°
04:54:33 - 180.03°
05:59:59 - 179.94°
06:00:00 - 180.00°
07:05:27 - 180.02°
08:10:54 - 180.00°
09:16:21 - 180.02°
10:21:49 - 179.99°
11:27:16 - 180.01°
12:32:43 - 180.02°

Interestingly, Hour 5 and Hour 6 share the same position -- meaning there are only 11 states and 22 times a day when the Hour hand and Minute hand are at parity with each other.

2. The Elegant Approach


In 1 hour:
* the Minute hand travels 360°
* the Hour hand travels 30°                                                              (Proof: 360 / 12)
* therefore: the Minute hand moves 12° for every degree of the Hour hand                 (Proof: 360 / 30) 

Observations (in sequential order):
* by the time the Minute hand has traveled 360°, the Hour hand has moved an extra 30°    (Proof: 360 / 12)
* the Minute hand needs to travel another 30° to be at parity with the Hour hand.
* by the time the Minute hand has traveled 30°, the Hour hand has moved an extra 2.5°    (Proof: 30 / 12)
* the Minute hand needs to travel another 2.5° to be at parity with the Hour hand.
* by the time the Minute hand has traveled 2.5°, the Hour hand has moved an extra 0.208° (Proof: 2.5 / 12)
* the Minute hand needs to travel another 0.207° to be at parity with the Hour hand.
* ...and so forth....

In total then, the Minute hand needs to move an extra:

Deriving the Formula

The above is a Geometric Series of the form:

The infinite Sum of such a series (convergent if k < 1):

So the Minute hand needs to travel 65mins and 27.3 seconds in order to achieve a constant angle between the Hour hand.

To calculate where the Minute hand will be for a given Hour, we just note that the "zero" state of the Minute hand starts at 6, and with this we can generate a general formula of:

         Minute Hand Angle (h) =  ((h - 6) mod 12) * 360 / 11
         Minute Hand Minutes (h)  = ((h - 6) mod 12) * 60 / 11

where h is a given hour


None. I got home a few minutes ago. I will watch TV and fall asleep.

Here's a nice interactive clock to play with


Glad to see I'm not the only person that goes on complex and disturbing (to everyone watching me) tangents when bored, hope you're doin' good!



hyperactivity might be mental illness, but it's a productive one!



something about this seems somehow practical, for some reason, but also I hope you had a relaxing time back at the pad! thx 4 sharin



it's gotten to the point that I tell my boss that I'll be late everyday and leaving early to work better from home, and he's okay with it



I've done the math behind this after staring at a clock and having the same question while in high school. Unlike your code, however, I'd never considered 5:59:59 as a possibility. In a subtle way, I think it's a demonstration that 0.999... == 1.



It's amazing what pure boredom can do, hah. As a teen at an airport, I once proved the area of a circle by taking the angle of packed triangles to the limit of 0. Not perfect maths mind you, but I was chuffed at the time nonetheless.

As for 5:59:59, the problem occurs because 0 and 360 are both possible values instead of me excluding one from the other. I wasn't sure how to do that elegantly, so I just left it and walked away whistling.

/ahem/ "An exercise for the reader" /ahem/