Skip to content

Sunday Times Brainteaser – Noughts and Crosses

by BRG on November 29, 2021

by Miss W. M. Jeffree

Published 23rd December 1956 (link)

Each square is to be occupied by either a zero or a cross, which stands for one particular digit which you may discover for yourself.

No row or column begins with a zero.

The following clues give the prime factors of the various rows and columns, each letter representing a different prime:

Rows:

Ā  (i) a b c d
Ā (ii) aĀ² bĀ² e f
Ā (iii) a bĀ² g h
Ā (iv) a b i jĀ² k
Ā  (v) aĀ² b e j l
Ā (vi) a bĀ² i k m

 

Columns:

Ā  (i) a bĀ² i j k m
Ā  (ii) aĀ² b e i jĀ² k
Ā (iii) a bĀ² m n p
Ā  (iv) aĀ² b c d e
Ā  (v) a b i j k l

 

From → Uncategorized

3 Comments Leave one →
  1. Brian Gladman permalink

    This teaser provided a nice exercise in using the new pattern matching facility introduced in Python 10. It also uses my number theory library (see here)

    • Frits permalink

      Interesting.

      – (iii) is not correct in the puzzle description.

      – you don’t seem to use the early determination of a and b (nice idea to determine variable a from crossing first row and column).

      – the check for no zeros in the first row could have been done earlier in the r4 loop (however, I know you like esthetically pleasing code).

      – output is a bit confusing as it looks like n and p have fixed values where as you only know the value of n x p.

      • Brian Gladman permalink

        Hi Frits

        Thanks for picking up the error in the description.

        I didn’t see an earlier way of determining a and b šŸ™

        I agree that the zeros check could be done earlier but it doesn’t really fit neatly
        in the earlier loop.

        The n and p issue is annoying but the way these two are found is different and
        its not easy to show the order ambiguity (a more complex replacement for line
        96 might be possible).

        PS: I have now updated the code to display the ambiguity in n and p. I also found that the use of pattern matching in the column reconstruction was a considerable overkill and was slow when compared with the simpler approach I am now using. This got the run time down to 14 milliseconds from around 50 previously.

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