Purely mathematical solution for "ideal mechanical clock":
(defun c:timeoverlaps (/ test_hours )
(defun to_hms (secs / hrs rem1 mins rem2 secs test_hours delseconds i overlaps)
(setq
hrs (/ secs 3600.0)
rem1 (rem secs 3600.0)
mins (/ rem1 60.0)
rem2 (rem mins 1.0)
secs (* rem2 60.0)
)
(strcat (rtos hrs 2 0) ":" (rtos mins 2 0) ":" (rtos secs 2 2))
)
(setq test_hours 12 delseconds (+ (* 65 60) (* (/ 5.0 11) 60)) i -1 )
(while (< (setq i (1+ i)) test_hours)(setq overlaps (cons (* i delseconds) overlaps)))
(mapcar 'princ (mapcar '(lambda (x)(strcat "\n" x)) (mapcar 'to_hms (reverse overlaps))))
(princ)
)
1:5:27.27
2:11:54.55
3:16:21.82
4:22:49.09
5:27:16.36
7:33:43.64
8:38:10.91
9:44:38.18
10:49:5.45
11:55:32.73
12:0:0
If we look at this clock hands overlaps we can see that seconds are actually wrong for every but last result.
Since we know that seconds hand is 60 times faster than minutes hand and 720 times faster than hours hand, seconds are irrelevant to final solution since at overlap times all three hand will stay on a mechanical watch within assumed angular tolerance. So correct clock hands overlap times are:
(defun c:timeoverlaps2 (/ test_hours )
(defun to_hms (secs / hrs rem1 mins rem2 secs test_hours delseconds i overlaps)
(setq
hrs (/ secs 3600.0)
rem1 (rem secs 3600.0)
mins (/ rem1 60.0)
rem2 (rem mins 1.0)
secs (* rem2 60.0)
)
(strcat (rtos hrs 2 0) ":" (rtos mins 2 0) ":" (rtos mins 2 0))
)
(setq test_hours 12 delseconds (+ (* 65 60) (* (/ 5.0 11) 60)) i -1 )
(while (< (setq i (1+ i)) test_hours)(setq overlaps (cons (* i delseconds) overlaps)))
(mapcar 'princ (mapcar '(lambda (x)(strcat "\n" x)) (mapcar 'to_hms (reverse overlaps))))
(princ)
)
1:5:5
2:11:11
3:16:16
4:22:22
5:27:27
7:33:33
8:38:38
9:44:44
10:49:49
11:55:55
12:0:0
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.