Brain-Teaser 29: [Mileage dates]
From The Sunday Times, 8th October 1961 [link]
My birthday was on Sunday last. As I drove my car out of the garage in the morning I noticed that the mileage read the same as the date, 11061 or 1.10.61. The car is driven to the station and back twice every day of the year and is used for no other purpose, the total distance each week being exactly 178 miles. By a coincidence the next occasion when the mileage at some time during the day will read the same as the date will be on my husband’s birthday.
When is this?
This puzzle was originally published with no title.
[teaser29]















Jim Randell 9:05 am on 4 April 2021 Permalink |
This Python program runs in 61ms.
from datetime import (date, timedelta) from enigma import (Rational, sprintf, first, arg, printf) Q = Rational() # rational implementation # find "special" days def solve(): m = 11061 # start mileage d = date(1961, 10, 1) # start date i = Q(178, 7) # daily mileage increment j = timedelta(days=1) # daily date increment while m < 311299: # calculate mileage at the end of the day m_ = m + i # write the date as a string s = sprintf("{dd}{mm}{yy:02d}", dd=d.day, mm=d.month, yy=d.year % 100) # turn them integers (a, b, x) = map(int, (m, m_, s)) # is x in [a, b]? if a <= x <= b: printf("{d}: {x} in [{a}, {b}]") yield (d, a, b) (m, d) = (m_, d + j) # find the first n solutions n = arg(2, 0, int) first(solve(), n)Solution: Sunday, 17th June 1962.
There is one more 5-digit mileage that occurs on a “special” day:
And then there are three 6-digit mileages that occur on “special” days in the 1990s:
LikeLike