Skip to content

Sunday Times Teaser 3118 – Product Dates

by BRG on June 24, 2022

by Edmund Marshall

Published Sunday June 26 2022 (link)

If a date during the current millennium is day D in month M during year (2000+N), it is said to be a product date if the product of D and M equals N (for example 11 February 2022). My daughter and I have been investigating the numbers of days from one product date to the next product date. I was able to establish the longest such interval L, while my daughter worked out the shortest such interval S. We were surprised to find that L is a whole number multiple of S.

What is that multiple?

From → Uncategorized

3 Comments Leave one →
  1. Brian Gladman permalink

  2. Frits permalink

    Without imports.

  3. Brian Gladman permalink

    @Frits

    I am not convinced that avoiding Python’s internal imports provides any real advantages as a lot of effort goes into optimising them and they get translated into bytecode and cached anyway.

    The other, more important point, is that when you write code to do something that an import can do, your code gets very limited use by you and a few others. In contrast a standard Python import will be used millions or billions of times by all its Python users and this means that if there are any errors in it they will be very quickly found and rectified. The reliability gain is hence enormous.

    And, although speed isn’t important here, avoiding imports seems to be costly as your version is significantly slower than my own (and does less work!) I expected it to be faster.

Leave a comment to Brian Gladman Cancel reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS