Skip to content

Sunday Times Teaser 3037 – Prime Advent Calendar

by Brian Gladman on December 4, 2020

by John Owen

Published Sunday December 06 (link)

Last year I was given a mathematical Advent calendar with 24 doors arranged in four rows and six columns, and I opened one door each day, starting on December 1. Behind each door is an illustrated prime number, and the numbers increase each day. The numbers have been arranged so that once all the doors have been opened, the sum of the numbers in each row is the same, and likewise for the six columns. Given the above, the sum of all the prime numbers is as small as it can be.

On the 24th, I opened the last door to find the number 107.

In order, what numbers did I find on the 20th, 21st, 22nd and 23rd?

From → Uncategorized

12 Comments Leave one →
  1. Brian Gladman permalink

    • Tony Smith permalink

      The comment in line 49 is true – but, because row and column sums are even, the sum must be divisible by both 8 and 12.

      I suspect that this does not affect the operation of the program – but perhaps the 12 in line 51 could be replaced by 24?

      • Brian Gladman permalink

        Hi Tony,

        You are right that I could increase the constraint to 24 but I would prefer to
        stick with the least common multiple of the number of rows and columns as this
        is the most obvious immediate constraint. It would improve the speed of the code
        very slightly to add the additional constraint of even column sums but this won’t
        change to results as this is already guaranteed by the code. This teaser seems
        hard manually and using 24 rather than 12 here might help quite a lot in allowing
        steps of 24 rather than 12 in checking the overall prime sum values.

  2. Frits permalink

    Hi Brian,

    You don’t report 24 different prime numbers.

  3. John Z permalink

    I think Line 48 should be:

    The current situation gives 107 twice in ps at line 53.

  4. John Z permalink

    I wrote my code withot seeing Brian’s; it is nevertheless surprisingly similar to his.
    My efforts at removing elements from lists could be more elegant.
    I changed exactly one line in my code after seeing Brian’s – see the comment below.

  5. John Z permalink

    Removing the constraint that the column sums be equal gives the same result.

    Any thoughts?

  6. Brian Gladman permalink

    Hi John,

    This is true for some row arrangements but not for others. If the programs are changed to allow multiple solutions, this shows that there are row sums for prime sums of 1080 (and higher) that do not allow equal sum columns. And this means that, in arriving at a solution, it is necessary to find an arrangement which provides both equal row and equal columns sums – finding equal row sums doesn’t necessarily provide equal column sums.

  7. John Z permalink

    My point is that if you remove the words “and likewise for the six columns” from John Owen’s Teaser, and seek a solution on that basis, it has the same unambiguous solution as with those words present. The numbers for the days 20-23 will be the same.

    Normally, each additional constraint in the Teaser statement reduces the solution space. It is not the case here.

    For example in a calendar with equal rows such as:
    [3, 5, 7, 47, 101, 107] 270
    [67, 37, 71, 41, 11, 43] 270
    [73, 13, 79, 17, 29, 59] 270
    [83, 19, 53, 23, 61, 31] 270

    There is no possible arrangement of the numbers in the rows giving equal column sums. But the Teaser solution is the same as if both row and column sums were equal such as occurs in the outputs of the above programs.

  8. Brian Gladman permalink

    Yes, if you remove the column constraint, then you obtain the same solution for a DIFFERENT teaser.

    Assuming you are right that it doesn’t meet the column constraint, the calendar you illustrate IS a solution to this modified teaser but IS NOT a solution to the original teaser. So I simply do not understand why you think the two solution spaces are the same.

    This situation is not unusual in teasers and it also happened recently in teaser 3029 where it was easy to find a possible answer but hard to show that the jigsaw layout was actually possible.

Leave a Reply

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

Subscribe to this comment feed via RSS