Skip to main content
The National Cipher Challenge

The Sunday Puzzle Thread

Viewing 20 reply threads
  • Author
    Posts
    • #154883
      harry
      Keymaster

      A place to discuss the solutions to the Sunday puzzles. We will hold back your posts until we publish the solutions, which, with a change of plan, we will now do on the Saturday after the puzzle is posted.
      Harry

      PS, we post the Sunday puzzles in the News feed on Sunday mornings. The first one is up now

      • This topic was modified 4 weeks, 1 day ago by Harry. Reason: Add info about current Sunday puzzle
    • #154945
      ByteInBits
      Participant

      SUNDAY PUZZLE #1 = Additive Alphametic
      ————————————————

      
       DATA
      +DATA
      =====
      FACTS
      
      For the alphametric with no leading zero allowed
      assuming base 10, there is 1 unique solution.
      
      -----------------------------------------------
      SOLUTION IN BASE 10
      
      Letter number values
       A  S  T  C  D  F 
       7  4  9  5  8  1 
      
       8797
      +8797
      =====
      17594
      
      SOLUTION IN BASE 10 IF LEADING ZERO ALLOWED
      
      Letter number values
       A  S  T  C  D  F 
       7  4  9  5  3  0 
      
       3797
      +3797
      =====
      07594
      
      -----------------------------------------------
      A SOLUTION IN BASE 9
      
      Letter number values
       A  S  T  C  D  F 
       6  3  8  4  7  1 
      
       7686
      +7686
      =====
      16483
      
      A SOLUTION IN BASE 9 IF A LEADING ZERO IS ALLOWED
      
      Letter number values
       A  S  T  C  D  F 
       7  5  8  6  3  0 
      
       3787
      +3787
      =====
      07685
      
      -----------------------------------------------
      A SOLUTION IN BASE 8
      
      Letter number values
       A  S  T  C  D  F 
       5  2  7  3  6  1 
      
       6576
      +6576
      =====
      15372
      
      -----------------------------------------------
      A SOLUTION IN BASE 7 IF A LEADING ZERO IS ALLOWED
      
      Letter number values
       A  S  T  C  D  F 
       5  3  6  4  2  0 
      
       2562
      +2562
      =====
      05463
      
      ------------------------------------------------------------
      Care to solve the unique base 10 solution for the following?
      
       CROSS
      +ROADS
      ======
      DANGER
      

      [Posted 03th September 21:25, Harry]

      • #158487
        Robb27
        Participant

        @ByteInBits

        I like this problem!

        1) D is straightforward:
        D = 1, given the carry from C + R = A

        2) We can quickly infer information about S and R:
        S + S = R implies R = [0, 2, 4, 6, 8] but we don’t know if there is a carry, and hence if these are from low values [0+0, 2+2, 3+3, 4+4] or high values [5+5, 6+6, 7+7, 8+8, 9+9] for S.

        S cannot be 0 otherwise S + S = R would mean S = R which is not allowed.
        S is not 5, if it was then R = 0. C + R = A must give a carry to get D. Therefore C would have to be 9 but require carry from R + O = N. The carry would only make C(=9) + R(=0) + 1 = 10 meaning A = 0 which is a contraction as R = 0.

        This reduces the possible values of R to [2, 4, 6, 8]

        S is not 9, if it was then R = 8, and there will be a carry so that S + D + 1 = E, giving S(=9) + (D=1) + 1 = 11, i.e. E = 1 which is a contraction as D = 1.

        This reduces the possible values of S to [2+2, 3+3, 4+4] or high values [6+6, 7+7, 8+8].

        3) At this point we have to up our logic game:
        Assume S = 2 and therefore R = 4
        Looking at C + R = A then C + 4 must be >= 10 to give a carry to get D, and noting that there may or may not be a carry from R + O = N too.
        C must be at least 5 and requires a carry. However,
        C is not 5 as with carry implies A = 0, but then O + A(=0) = G implies A = G which is not allowed.
        C is not 6 as without carry from R + O = N this implies A = 0, but then O + A(=0) = G implies A = G which is not allowed.
        C is not 6 as with carry from R + O = N this implies A = 1 which is a contradiction as D = 1.
        C is not 7 as without carry from R + O = N this implies A = 1 which is a contradiction as D = 1.
        C is not 7 as with carry from R + O = N this implies A = 2 which is a contradiction as S = 2
        C is not 8 as without carry from R + O = N this implies A = 2 which is a contradiction as S = 2
        C is not 8 as with carry from R + O = N this implies A = 3, but S(=2) + D(=1) = E = 3 which is a contradiction.
        C is not 9 as without carry from R + O = N this implies A = 3, but S(=2) + D(=1) = E = 3 which is a contradiction.
        C is not 9 as with carry from R + O = N this implies A = 4 which is a contradiction as R = 4
        Hence, there are no valid solutions for S = 2

        4) We can repeat this logic (I leave that to you to do) and thankfully we quickly find a valid solution where S = 3 and R = 6
        CROSS = 96233
        ROADS = 62513
        DANGER = 158746
        with C=9, R=6, O=2, S=3, A=5, D=1, N=8, G=7, E=4.

        We can also write a Python program to generate valid solutions, and actually find that this is the only valid solution (in base 10 😉 @ByteInBits I haven’t checked any other bases, but as we have 9 unique letters, then Base 10 is the lowest base)

        from itertools import permutations
        
        letters = "CROSADNGE"
        count = 0
        
        for digits in permutations(range(10), len(letters)):
            value = dict(zip(letters, digits))
            if value["C"] == 0 or value["R"] == 0:
                continue
        
            cross = (10000 * value["C"] + 1000 * value["R"]
                     + 100 * value["O"] + 11 * value["S"])
            roads = (10000 * value["R"] + 1000 * value["O"]
                     + 100 * value["A"] + 10 * value["D"] + value["S"])
            danger = (100000 * value["D"] + 10000 * value["A"]
                      + 1000 * value["N"] + 100 * value["G"]
                      + 10 * value["E"] + value["R"])
        
            if cross + roads == danger:
                count += 1
                print(f"{cross} + {roads} = {danger}")
                print(value)
        
        print(f"Total solutions: {count}")
    • #156824
      ByteInBits
      Participant

      Others posted (unseen) answers in their own threads before this
      thread went up, as the hashtag numbers show they were in the
      following order of submit.

      Pos Hashtag Participant
      1st #153274 Krishie-Ramnath
      2nd #153861 Robb27
      3rd #154945 ByteInBits

      Unlike myself they answered in full so go read their entries 😉
      The official answer will be in the NEWS along with another puzzle from Harry on Sunday morning.

    • #158756
      ByteInBits
      Participant

      @Robb27 You are correct on all points.
      If you wish to amuse yourself further:
      TRY DOUBLING UP FOR DANGER
      You should get 8 answers 6 with C,R,D not equel to zero, 2 answers with D or R = zero
      One of the answers is zero free for all letters! What is it?

      
       CROSS
       ROADS
       CROSS
      +ROADS
      ======
      DANGER
      
      • #162402
        Robb27
        Participant

        @ByteInBits
        Took a little while to work these through by hand, but I then checked with a simple adjustment to my previous python program.
        I won’t write out the logic for each, there is too much, however, I have included one…

        12933 + 29803 = 85472
        C=1, R=2, O=9, S=3, A=8, D=0, N=5, G=4, E=7

        This was probably the easiest, started by assuming D=0, then 2C+2R <=9, hence C and R can only be 2*3 + 2*1 or 2*2 + 2*1 Given that R must be even as 4S=R, then C=1 and R=2.

        The are only two values of S that give R=2, they are S = 3 (=12) and S = 8 (=32).
        As D=0, then 2S + 2D = E gives E either 2*3 + 0 + 1 carry = 7 or 2*8 + 0 + 3 carry = 9 with 1 carry.

        As 0, 1 & 2 are taken, O is at least 3, meaning 2R + 2O = N is at least 10 hence there will be a carry. As O could be 9 then the carry is either 1 or 2, but not 3, and leaving A as either [7, 8].

        Lets look at O in 2R + 2O = N
        O is not 3, 2R+2O=10 hence A=7 and N is notionally 0. Then 2O + 2A = 20, this mean N is now 2, which is a contradiction with R.
        O is not 4, 2R+2O=12 hence A=7 and N is notionally 2. Then 2O + 2A = 22, this mean N is now 4, which is a contradiction with O.
        O is not 5, 2R+2O=14 hence A=7 and N is notionally 4. Then 2O + 2A = 24, this mean N is now 6 which is OK and G is notionally 4. As A=7, S can’t be 3, so must be 8. E = 9 which is ok but carries 1 over to G making G = 5, which is a contradiction with O.
        O is not 6, 2R+2O=16 hence A=7 and N is notionally 6. Then 2O + 2A = 26, this mean N is now 8 which is ok and G is notionally 6. As A=7, S can’t be 3, so must be 8. E = 9 which is ok but carries 1 over to G making G = 7 which is a contradiction with A.
        O is not 7, 2R+2O=18 hence A=7 which is a contradiction with O.
        O is not 8, 2R+2O=20 hence A=8 which is a contradiction with O.

        Therefore O must be 9
        Checking 2R+2O=22 hence A=8 and N is notionally 2. Then 2O + 2A = 34, this means N is now 5 which is ok and G is notionally 4. As A=8, S can’t be 8, so must be 3. E = 7 which is ok. There is no carry so G = 4 which is also good.

        We have a solution 12933 + 29803 = 85472 with C=1, R=2, O=9, S=3, A=8, D=0, N=5, G=4, E=7

        The rest are found using similar logic:
        54911 + 49021 = 207864
        C=5, R=4, O=9, S=1, A=0, D=2, N=7, G=8, E=6

        72033 + 20813 = 185692
        C=7, R=2, O=0, S=3, A=8, D=1, N=5, G=6, E=9

        74166 + 41326 = 230984
        C=7, R=4, O=1, S=6, A=3, D=2, N=0, G=9, E=8

        76399 + 63829 = 280456
        C=7, R=6, O=3, S=9, A=8, D=2, N=0, G=4, E=5

        76844 + 68924 = 291536
        C=7, R=6, O=8, S=4, A=9, D=2, N=1, G=5, E=3

        80355 + 3615 = 167940
        C=8, R=0, O=3, S=5, A=6, D=1, N=7, G=9, E=4

        94711 + 47821 = 285064
        C=9, R=4, O=7, S=1, A=8, D=2, N=5, G=0, E=6

    • #157299
      Robb27
      Participant

      Sunday puzzle 2: A bug in the system
      The shortest distance is a straight line. If you imagine the hall is a box and you ‘flatten the box out’ to a 2D layout, the spider is 6m vertically and 26m horizontally from the bug. Pythagoras tells us that the shortest route, which is the hypotenuse, is ~26.68m = SQRT(26^2 + 6^2).

    • #157362
      ByteInBits
      Participant

      Sunday Puzzle number 2

      
      The shotest route is 30.46309 metres
      
      The course is different and the distance shorter than
      'common sense' would suggest. This can be verified by
      constructing a simple three dimensional model and
      opening it up like so:
      
      south          20m
      --------------------------------
      |      |                       |
      |    A |      ceiling          | 6m
      |      |                       |
      -------------------------------- Draw a strait line from A to B (Hypotenuse)
        8m   |                       | The Path spider takes (H)
          6m |      wall             |
             |                       |  8m
             --------------------------------
             |                       |      |
           c |      floor            |    B | Draw lines A to c and B to c
             |                       |      | to form a right triangle
             --------------------------------
             |                       | north
             |      wall             |
             |                       |
             -------------------------
      
      Mark the begging point A and end point B, now draw a strait line between
      them this will be the hypotenues H, if we draw two right angle lines from A 
      and B to c we form a right angled triangle, study of the distances the lines
      encompose we get:
      
      Line A = 3 + 6 + 3 = 12 metres
      Line B = 1 +20 + 7 = 28 meters
      To find the H : squreroot of ( 12^2 + 28^2 ) = 30.46309 metres
      
      This being the shortest distance between two given points.
      
    • #157356
      ByteInBits
      Participant

      Sunday puzzle number 2 : *** QUERY ***

      Harry, are you expecting an integer answer to your variation of this?

      I think normally this puzzle is set with dimensions that give an integer.
      I remember doing this puzzle many years ago though it was slightly
      different in that both the start and end positions were 1 metre from
      ceiling. Either way it is done I don’t get an integer.

      As an exsample here is a simular problem and my answer:

      Room 30 metres long, 12 metres wide and 12 metres high.
      Start middle of 12 metre wall, 1 metre below ceiling.
      End middle of opposite wall, 1 metre below ceiling.

      Answer is 40 metres

    • #162160
      ByteInBits
      Participant

      OOPS I got the 6m and 8m transposed 🙁

    • #162228
      ByteInBits
      Participant
      
      No, no, no, wait a mo, transposing the 8m and 6m was not at fault but
      I did missplace the sensor.
      
      My answer is now 25.0599m NOT same as Harry's - Help,
      
      Harry gave squreroot of ( 10^2 + 24^2 ) = 24
      I'm at a loss as to how ?
      
      I do not understand where the 10m and 24m comes from. Please enlighten me.
      
      constructing a simple three dimensional model and
      opening it up like so:
      
      and using the given dimensions:
      20 metres long
      6 metres wide
      8 metres high
      
      south
         8m          20m
      ------------------------------
      | <---    |   ceiling          |
      |       A*|********************| 6m
      |wall   . |                    |           Diagram not to scale.
      --------.-----------------------      <--- direction down to floor of wall
              . |                    |      *** strait path of spider = 1+20+7 =28m
              . |6m    wall          |      ... lines of AC and CB right triangle of AB
              . |                    |  8m   Remember A and B are in the Middle of wall.
              . -------------------------------     AC = 3+6+3 = 12m
              . |      floor         | <---   |     CB = 1+20+1= 22m
              C.|....................|.B******| 6m  AB line not drawn
                |                    |    wall|     AB = sqrt(12^2+22^2) = 25.0599m
                -------------------------------     so 3m less than *** route.
                |                    |    north
                |      wall          |
                |                    |
                ----------------------
      
      
    • #162388
      Robb27
      Participant

      @ByteInBits
      I was humbled too, I missed the ceiling to floor fold. I have borrowed and adjusted your diagram. Hope this now makes sense?

      Diagram not to scale.

      6m 20m
      ——————————–
      |wall 3m->| * Wall |
      | A | | 7m | 8m
      | . | | | 6m
      —–.——-*—————————
      . | ^ | > 1m |
      . | | 3m | |
      C….|..*……………..|.B | 8m
      | floor | |
      ——————————-

      … lines of AC and CB right triangle of AB
      AC = 7+3 = 10m
      CB = 3+20+1 = 24m
      AB = sqrt(10^2+24^2) = 26m

      • #162405
        Robb27
        Participant

        Lets retry that diagram with code tags!

        
            6m             20m
        --------------------------------
        |wall 3m->|  *    Wall         |
        |    A    |  | 7m              | 8m
        |    .    |  |                 |   6m
        -----.-------*---------------------------
             .    |  ^                 | > 1m   |
             .    |  | 3m              |        |  
             C....|..*.................|.B      | 8m
                  |      floor         |        |
                  ------------------------------- 
    • #162483
      ByteInBits
      Participant

      @Robb27 Thanks.

    • #162911
      Robb27
      Participant

      Sunday puzzle 3: One rotten apple (doesn’t necessarily spoil the barrel)

      I had to dust off memory for this one, so I hope I have remembered correctly. I do remember that there are two types of parity checking; Even and Odd. It is not clear which one applies. This is usually agreed in advance of sending messages. I have answer using both as both gave me an answer I could reason logically. That said, I think the answer was probably expecting Even parity, as you will see from my reasoning.

      Even parity checking:
      – Gold checks 1, 2 and 7 = 3 and even parity places a 1 in 4.
      – Blue checks 1, 3 and 7 = 3 and even parity should place a 1 in 5, but there is a 0.
      – Red checks 2, 3 and 7 = 3 and even parity should place a 1 in 6 but there a 0.

      Logic tells me that the wrong bit must belong to Blue and Red but not Gold, hence bit 3 must be wrong.
      The correct original seven-bit message was 1101001.
      The four-bit message, having removing the error checking bits 4, 5 and 6, is therefore 1101.

      Odd parity checking:
      – Gold checks 1, 2 and 7 = 3 and odd parity should place a 0 in 4, but there is 1.
      – Blue checks 1, 3 and 7 = 3 and odd parity places a 0 in 5.
      – Red checks 2, 3 and 7 = 3 and odd parity places a 0 in 6.
      Blue and Red are correct but not Gold. There could be an issue with bit 1 or 2, but if either of them was changed then the Blue or Red check would then fail meaning another bit is also wrong. Whilst it is possible for more than a single bit to be wrong, we are told that exactly one bit was changed. Therefore, with odd parity checking, bit 4 must be wrong.

      The correct original seven-bit message was 1110001.
      The four-bit message, having removing the error checking bits 4, 5 and 6, is therefore 1111.

    • #163923
      ByteInBits
      Participant

      Hi @Robb27,
      I have only now (5 days later) seen your post #162402

      You really are a good logician, love the way you work it through, and
      of course you are right with all 8 answers, including the one with no
      zeros (your 6th answer.)

      I did not properly understand this weeks puzzle 3, so I had to give it a miss.

    • #164029
      ByteInBits
      Participant

      Sunday Puzzle 4 – Mind the gap

      Solve done manually.
      Spreading it out from 2×8 to 1×16 makes for easier solving.
      For spacing reasons 10 to 16 (double digits) replaced with A to G.

      •1•2•3•4•5•6•7•8•9•A•B•C•D•E•F•G• Position
      •-•8•-•-•-•6•-•-•5•-•-•-•-•1•-•-• Channels Given
      •3•8•4•7•3•6•2•4•5•2•8•7•6•1•5•1• MY SOLVE

      Pairing radio units
      ====================
      Channel••Hansets
      1 •••••• 14 & 16 (E,G)
      2 •••••• 7 & 10 (7,A)
      3 •••••• 1 & 5
      4 •••••• 3 & 8
      5 •••••• 9 & 15 (9,F)
      6 •••••• 6 & 13 (6,D)
      7 •••••• 4 & 12 (4,C)
      8 •••••• 2 & 11 (2,B)

    • #164727
      Holmium
      Participant

      I think:

      Sunday puzzle 4: Solution

      Requirement and given answer:
      ?, 8, ?, ?, ?, 6, ?, ?, 5, ?, ?, ?, ?, 1, ?, ?
      3, 8, 4, 7, 3, 6, 2, 4, 5, 2, 8, 7, 6, 1, 5, 1.

      Assumptions:
      The 8 in position 2 forces the other 8 into position 11. Correct
      The 6 in position 6 forces the other 6 into position 13. Correct
      The 5 in position 9 forces the other 5 into position 15. Incorrect – it can also go in position 3.
      The 1 in position 14 forces the other 1 into position 16. Incorrect – it can also go in position 12.

      The above gives four possible solutions:

      3, 8, 4, 7, 3, 6, 2, 4, 5, 2, 8, 7, 6, 1, 5, 1
      2, 8, 5, 2, 4, 6, 7, 3, 5, 4, 8, 3, 6, 1, 7, 1
      3, 8, 5, 2, 3, 6, 2, 7, 5, 4, 8, 1, 6, 1, 4, 7
      2, 8, 3, 2, 4, 6, 3, 7, 5, 4, 8, 1, 6, 1, 5, 7

    • #164737
      BruceForce
      Participant

      I propose that the elf that created SP#4 and the elf that wrote its solution be put to the test.

      • This reply was modified 5 days, 17 hours ago by Harry.
      • This reply was modified 5 days, 17 hours ago by Harry.
      • #164743
        Holmium
        Participant

        Assuming my previous post was correct, which is a big assumption given my age matches the atomic number of my display name and my eyes grow dim…

        I would suggest the follow-up question …

        Can you find a positioning solution for SP#4 with radio 1 in position 8 and radio 2 in position 5, but no other constraints, other than that of the previously prescribed radio pair separations, for all radios 1 through 8?

    • #164846
      Robb27
      Participant

      @Harry/@Eleves has my #164091 been missed, or is there another reason it is still in moderation?

      • #164849
        harry
        Keymaster

        Not sure, I will check with the elves (they have been out on launch drill ready for Christmas Eve so I can’t ask today)

      • #164865
        Elf_on_the_Shift
        Keymaster

        Should be approved now!

    • #164091
      Robb27
      Participant

      Sunday puzzle 4: Mind the gap

      @Harry
      … the answer doesn’t appear unique? If I am wrong, I am not sure where my logic, or programming, is incorrect.

      With unit 8 in position 2 that means the other unit 8 must be in position 11
      With unit 6 in position 6 that means the other unit 6 must be in position 13

      So now we have
      Position: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
      Channel : ?, 8, ?, ?, ?, 6, ?, ?, 5, ?, 8, ?, 6, 1, ?, ?

      The rest we have to figure by looking for contradictions using the possible positions noted in the diagrams below.

      The right hand side looked a good place to start and figuring it out quickly led me to the answer:
      -As we have unit 1 in position 14, the other unit 1 can only go in positions 12 or 16. This immediately meant that Unit 3 possibility 5 can’t be valid as that uses both positions 12 and 16 so would mean we couldn’t place the second unit 1.
      -Working backwards through the unit 3 possibilities, I then considered the Unit 3 possibility 4, where the units are in position 8 and 12. If this is correct, then the second unit 1 must be in position 16. These two placings mean that (1) the only valid unit 7 possibility is placing the units 7 in positions 7 and 15, and (2) the only valid unit 4 possibility is placing units 4 in positions 5 and 10

      We have now placed units 1, 3, 4, 5, 6, 7 and 8 leaving the remaining two empty positions for unit 2 being 1 and 4, which are also correctly spaced, so must be the correct answer.

      I have shown the possible positions for units 3, 4, 5 and 7. I didn’t need to consider unit 2 to work out the answer.

      Position:  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16
      
      Possible Unit 3
      U3 Pos 1:  3,  *,  *,  *,  3,  -,  -,  -,  -,  -,  -,  -,  -,  -,  -,  -
      U3 Pos 2:  -,  -,  3,  *,  *,  *,  3,  -,  -,  -,  -,  -,  -,  -,  -,  -
      U3 Pos 3:  -,  -,  -,  3,  *,  *,  *,  3,  -,  -,  -,  -,  -,  -,  -,  -
      U3 Pos 4:  -,  -,  -,  -,  -,  -,  -,  3,  *,  *,  *,  3,  -,  -,  -,  -
      U3 Pos 5:  -,  -,  -,  -,  -,  -,  -,  -,  -,  -,  -,  3,  *,  *,  *,  3
      
      Possible Unit 4
      U4 Pos 1:  -,  -,  4,  *,  *,  *,  *,  4,  -,  -,  -,  -,  -,  -,  -,  -
      U4 Pos 2:  -,  -,  -,  -,  4,  *,  *,  *,  *,  4,  -,  -,  -,  -,  -,  -
      U4 Pos 3:  -,  -,  -,  -,  -,  -,  4,  *,  *,  *,  *,  4,  -,  -,  -,  -
      
      Possible Unit 5
      U5 Pos 1:  -,  -,  5,  *,  *,  *,  *,  *,  5,  -,  -,  -,  -,  -,  -,  -
      U5 Pos 2:  -,  -,  -,  -,  -,  -,  -,  -,  5,  *,  *,  *,  *,  *,  5,  -
      
      Possible Unit 7
      U7 Pos 1:  -,  -,  -,  7,  *,  *,  *,  *,  *,  *,  *,  7,  -,  -,  -,  -
      U7 Pos 2:  -,  -,  -,  -,  -,  -,  7,  *,  *,  *,  *,  *,  *,  *,  7,  -
      U7 Pos 3:  -,  -,  -,  -,  -,  -,  -,  7,  *,  *,  *,  *,  *,  *,  *,  7

      I thought I was done until I looked at the bonus challenge of programming a solution!

      We start the same:
      With unit 8 in position 2 means that the other unit 8 must be in position 11
      With unit 6 in position 6 means that the other unit 6 must be in position 13
      The rest we have to figure by looking for contradictions using the possible positions noted in the diagrams below.

      The right hand side looked a good place to start and figuring it out quickly led me to the answer:
      -As we have unit 1 in position 14, the other unit 1 can only go in positions 12 or 16.

      But If I make a different assumption…
      -If I assume that the units 7 goes in position 8 and 16, then the second unit 1 must go in position 12.
      -These two placings mean that (1) the only valid unit 4 possibility is placing the units 4 in positions 5 and 10 and (2) the only valid unit 3 possibility is placing units 3 in positions 3 and 7.

      We have now placed units 1, 3, 4, 5, 6, 7 and 8 leaving the remaining two empty positions for unit 2 being 1 and 4, which are also correctly spaced, so this must be ANOTHER correct answer!?

      So now the answer doesn’t appear unique as suggested, and in fact I find two other possible correct answers starting with a different assumptions (not shown as this post is long engough). This is supported by my python.

      Position: 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16
      Soln 1:   2,  8,  5,  2,  4,  6,  7,  3,  5,  4,  8,  3,  6,  1,  7,  1
      Soln 2:   2,  8,  3,  2,  4,  6,  3,  7,  5,  4,  8,  1,  6,  1,  5,  7
      Soln 3:   3,  8,  4,  7,  3,  6,  2,  4,  5,  2,  8,  7,  6,  1,  5,  1
      Soln 4:   3,  8,  5,  2,  3,  6,  2,  7,  5,  4,  8,  1,  6,  1,  4,  7

      `units = {2: 8, 6: 6, 9: 5, 14: 1} #radio unit positions given
      row = [0] * 16 #hold the radio number positions
      solutions = []

      def search(n=8): #8 sets of 2 radios
      if n == 0:
      if all(row[p – 1] == r for p, r in units.items()):
      solutions.append(row.copy())
      return

      for i in range(16 – n – 1): #8 sets of 2 radios =16, but 0 based
      j = i + n + 1 #place each radio pair n + 1 positions apart
      if row[i] or row[j]: #if position i or position j already contains a radio (a value bigger than 0) move to the next placing attempt.
      continue
      if any(p in units and units[p] != n for p in (i + 1, j + 1)): #prevent placing a new radio where one already exists
      continue

      row[i] = row[j] = n
      search(n – 1) #recursively search decreasing from n to 0
      row[i] = row[j] = 0

      search()

      for solution in solutions:
      print(*solution)
      print(f”{len(solutions)} solutions”)’

    • #164852
      ByteInBits
      Participant

      The elves are on the shelves !

      • #164867
        Elf_on_the_Shift
        Keymaster

        Seems like this one’s back on shift 😉

      • #164871
        harry
        Keymaster

        Not sure that exercising the Reindeer and planning optimal delivery routes count as sitting on a shelf.

    • #164879
      ByteInBits
      Participant

      Don’t thing I’ll be getting anything for xmas now 🙁
      Unless the naughty one favours me 😉

    • #164921
      Holmium
      Participant

      If you are enjoying the National Cipher Challenge and the Sunday Puzzles, you may enjoy the GCHQ Monday Puzzle.

Viewing 20 reply threads
  • You must be logged in to reply to this topic.
Report a problem