Teaser 2671: On the face of it
From The Sunday Times, 1st December 2013 [link] [link]
At the beginning of last year my wife and I were each given a clock. When we first looked at them the hands on both clocks showed the correct time but thereafter (although the two clocks coincided at least once more during the year) they generally showed different times.
The problem was that my clock gained a certain whole number of minutes each day, and the same was true of my wife’s clock, but hers was even faster than mine. Actually my clock showed the correct time at least once in every month last year but that was not the case for my wife’s clock.
How many minutes did each clock gain in a day?
[teaser2671]









Jim Randell 5:17 pm on 19 February 2024 Permalink |
In this puzzle I am assuming that the clocks are standard 12-hour analogue clocks, that are not adjusted during the year (even for daylight savings time), and the correct time is also not adjusted for DST, and that the puzzle takes place in the year 2012 (it was originally published in 2013).
Clock 1 showed the correct time at least once each month in 2012, but Clock 2 did not.
Some time in January both clocks are correct, and some other time during the year (2012 had 366 days), both clocks are showing the same time. And the first time this happens Clock 2 is exactly 12 hours ahead of Clock 1. So during the course of up to 366 days, it has gained 720 minutes over Clock 1, this means the Clock 2 is gaining at least 2 minutes per day more than Clock 1.
If it gains only 2 minutes more then it will take 360 days to get 720 minutes ahead of Clock 1, and so this will only work if the clocks are first looked at during the first 6 days of January. If it gains 3 or more minutes, any time in January will suffice.
But if Clock 2 gains 720 minutes (or more) in any 29 day period, then it cannot avoid showing the right time in every month. So Clock 2 must gain less than 25 minutes per day.
For each possible set of gains per day, this Python program looks for the earliest time in January when the clocks could give a correct time.
It runs in 56ms. (Internal runtime is 302µs).
Run: [ @replit ]
from datetime import (datetime, timedelta) from enigma import (irange, irangef, fdiv, repeat, inc, divf, arg, printf) # year Y = arg(2012, 0, int) # calculate max gain for clock 2 (depends on number of days in Feb) M = divf(720, (datetime(Y, 3, 1) - timedelta(days=1)).day) # return day offsets when a clock gaining <x> minutes per day # has gained multiples of 720 minutes offsets = lambda x: list(irangef(0, 366, step=fdiv(720, x))) # look for earliest time when clocks are correct # with clock 1 gaining x min/day for x in irange(1, M - 2): # day offsets for clock 1 ds1 = offsets(x) # clock 1 is correct at least once in each month if len(ds1) < 12: continue # clock 2 gains at least 2 min/day more than clock 1 for y in irange(x + 2, M): # choose a time in Jan when the clocks are correct for t in repeat(inc(timedelta(minutes=1)), datetime(Y, 1, 1, 0, 0, 0)): if t.month > 1: break # find dates when clock 1 shows the correct time ts1 = list(t + timedelta(days=x) for x in ds1) # look for these occurring in 12 different months if not (len({t.month for t in ts1}) == 12): continue # find the dates when clock 2 is correct ts2 = list(t + timedelta(days=x) for x in offsets(y)) # look for these occurring in fewer than 12 different months if not (len({t.month for t in ts2}) < 12): continue # check when the clocks are showing the same time s = t + timedelta(days=fdiv(720, y - x)) if s.year > Y: continue # earliest solution found printf("clock 1 gains {x} mins/day") for z in ts1: printf("-> clock 1 correct @ {z}") printf("clock 2 gains {y} mins/day") for z in ts2: printf("-> clock 2 correct @ {z}") printf("clocks read same time @ {s}") printf() breakSolution: The clocks gain 22 minutes and 24 minutes per day.
If the clocks both show the correct time at midnight on 1st January 2012 then clock 1 shows the correct time at:
We see that each of the 12 correct times occurs in a different month.
And clock 2 shows the correct time at:
Although this clock shows 13 correct times in the same interval that the other clock shows 12 correct times, it has 2 correct times in January, 2 correct times in March, and no correct times in February.
After 360 days, on 2012-12-26 @ 00:00, clock 1 has gained 7920 min = 5.5 days, and clock 2 has gained 8640 min = 6 days, so both clocks are showing the same (correct) time of 12:00.
However, if we were to run the same puzzle in 2013 (not a leap year), we still get a solution with 22 min/day and 24 min/day (although dates after Feb are a day earlier, so clock 2 has 2 correct times in May not March), but we also find there is a second solution, where clock 1 gains 23 min/day and clock 2 gains 25 min/day.
For example if the clocks both clocks show the correct time at 9:36am on 2nd January 2013, then clock 1 shows the correct time at:
And clock 2 shows the correct time at:
After 360 days, on 2012-12-28 @ 09:36, clock 1 has gained 8280 min = 5.75 days, and clock 2 has gained 9000 min = 6.25 days, so both clocks are showing the same (incorrect) time of 3:36.
And a third solution with the clocks gaining 22 min/day and 25 min/day, where the clocks start on 2013-01-02 @ 09:36 and show the same time after 240 days at 2013-08-30 @ 09:36.
LikeLike
Frits 9:51 am on 23 February 2024 Permalink |
from datetime import date, timedelta from math import ceil DAYS = 366 # dictionary month number per day (day 31 becomes month 2 (2012-02-01 00:00)) d = {i: (date(2012, 1, 1) + timedelta(days=i)).month for i in range(1, DAYS + 1)} # "I" need to have a correct time in at least another 11 months mn = ceil(11 * 720 / DAYS) # maximum gain for not to have a guaranteed correct time at least once a month mx = ceil(720 / 29) - 1 for my in range(mn, mx - 1): mths = set(d[ceil((m * 720) / my)] for m in range(1, (my * DAYS) // 720 + 1)) # at least twelve different months? if len({1} | mths) == 12: mytimes = set(ceil((m * 720) / my) for m in range(1, (my * DAYS) // 720 + 1)) # my wife's clock is gaining at least 2 minutes per day more than my clock for wife in range(my + 2, mx + 1): mths = set(d[ceil((m * 720) / wife)] for m in range(1, wife * DAYS // 720 + 1)) if len({1} | mths) < 12: wifetimes = {ceil((m * 720) / wife) for m in range(1, wife * DAYS // 720 + 1)} # the two clocks coincided at least once more during the year if mytimes & wifetimes: print(f"answer: {my} and {wife}")LikeLike