Enigmatic Code

Programming Enigma Puzzles

Tantalizer 429: Merry Christmas

From New Scientist #980, 18th December 1975 [link]

Gloom or no gloom, the call for toys rises and Santa has taken on three extra reindeer this year, Starlight, Snowflake and Rudolf. He has been planning a monster sleigh, pulled by them and his old friends Comet, Cupid, Donner and Blitzen, Dasher and Dancer, Prancer and Vixen.

But then a horrid thought struck him. What if this pantechnikon and all eleven reindeer were hijacked? So dreadful is the prospect that he has changed tack entirely. Instead he will make a series of deliveries, each in a modest sleigh pulled by a different pair of reindeer. It has not been easy to arrange, since the reindeer think he is being feeble and have offered very varying degrees of cooperation. Indeed only Rudolph and Cupid will be making the same number of deliveries. But it will work as proposed and you can go ahead and hang your sock up.

Rudolf is boasting that he will be doing exactly twice as many deliveries as Blitzen. Blitzen maintains that this is not true. Santa asks you to work out which is right. Meanwhile he wishes you a Merry Christmas.

[tantalizer429]

One response to “Tantalizer 429: Merry Christmas

  1. Jim Randell 15 May 2019 at 8:18 am

    There are eleven reindeer, and each can be paired any of the other ten. So the number of deliveries any reindeer can make is from 0 to 10.

    If we were to make a list of the number of deliveries made by each we would get:

    (Rudolf=a, Cupid=a, Blitzen=b, Starlight=c, …, Vixen=j)

    where a, b, c, …, j are 10 different numbers (i.e. exactly one of the numbers from 0 to 10 is missing).

    But if one of them does 10 trips then they must be partnered with each of the other reindeer, so no-one does 0 trips.

    i.e. if the missing number is not 10, then it must be 0.

    So the missing number is either 0 or 10.

    And each trip is mentioned by both reindeer involved, so if n is the total number of trips:

    a + a + b + c + d + e + f + g + h + i + j = 2n
    n = a + (b + c + d + e + f + g + h + i + j) / 2

    This Python considers the possibilities for the missing number, and the number a, and records whether a can be odd or even.

    If there are no even possibilities for a, then Rudolf cannot be making exactly twice the number of deliveries of another reindeer.

    The program runs in 89ms.

    Run: [ @repl.it ]

    from enigma import irange, div, printf
    
    # sum of numbers from 1 to 10
    T = sum(irange(0, 10))
    
    # count [ <even solutions>, <odd solutions> ]
    r = [ 0, 0 ]
    
    # consider values for the missing number k
    for k in (0, 10):
    
        # consider possible values for a
        for a in irange(0, 10):
          if a == k: continue
    
          n = div(T - k - a, 2)
          if n is None: continue
    
          printf("[a={a} k={k}]")
          r[a % 2] += 1
    
    printf("{r[0]} even solutions, {r[1]} odd solutions")
    

    Solution: Blitzen is right.

    But is it possible to construct such a schedule? Yes, it is, when Rudolf and Cupid make 5 trips each.

    Here is a possible schedule with 25 trips:

    1: Rudolf + Cupid
    2: Rudolf + Dasher
    3: Rudolf + Dancer
    4: Rudolf + Prancer
    5: Rudolf + Vixen
    6: Cupid + Dasher
    7: Cupid + Dancer
    8: Cupid + Prancer
    9: Cupid + Vixen
    10: Snowflake + Vixen
    11: Comet + Prancer
    12: Comet + Vixen
    13: Donner + Dancer
    14: Donner + Prancer
    15: Donner + Vixen
    16: Blitzen + Dasher
    17: Blitzen + Dancer
    18: Blitzen + Prancer
    19: Blitzen + Vixen
    20: Dasher + Dancer
    21: Dasher + Prancer
    22: Dasher + Vixen
    23: Dancer + Prancer
    24: Dancer + Vixen
    25: Prancer + Vixen

    Rudolf and Cupid each make 5 trips. The others make: 0, 1, 2, 3, 4, 6, 7, 8, 9 trips.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: