Skip to content

09 Secret Presents

© Christoph Graczyk, MATH+

Authors:  Felix und Nathanael Höfling

Project: EF 4-10

Challenge

Santa Claus, like every year, is very grateful for the great work of his elves and would like to give each of them a gift. However, he cannot write the names on the gifts, as the surprise would be spoiled. One day, Dwarf Alwin comes to visit, and Santa Claus explains the problem to him. “Dear Alwin, what should I do?” The clever Alwin immediately has an idea: “You could write a secret code on each gift for every elf. It is important that no code is repeated. Also, similar names should get completely different codes so that they cannot guess the names. I will create a list of codes for you.”

For each name, Dwarf Alwin calculates a four-digit secret code in the following way:

First, he translates the letters of the name according to their position in the alphabet into numbers. For example, an E becomes 5, an M becomes 13, and Z gets 26, and so on. Then, he fills in a table with two rows, as shown in the table below. In the first column, he writes a 1 at the top and a 0 at the bottom. Then, in the first row, he adds the value of the next letter to the last written number. Before adding the result to the row, he makes sure that the number is less than 47. If the result is greater than or equal to 47, he subtracts 47 from the result. If the result is less than 10, a leading zero is added, for example, 7 becomes 07. In the second row, he follows the same process, except that he always adds the corresponding (above) entry from the first row to the last written number. Finally, he takes the last number from both rows and writes them one after the other, with the number from the second row first—this is the secret code of the name. Using this method, for example, Luise gets the code 3120, as shown in the picture.

A while later, Santa Claus happily holds the list of secret codes in his hand and gets to work. In the elf workshop, he orders a beautiful gift for each of his elves, but not under their names; instead, he uses the secret code. On the day before Christmas Eve, he prepares his sleigh. At the North Pole, it is cold, and a terrible snowstorm is raging. As Santa turns to his reindeer, his coat opens slightly, the wind catches the list of secret codes, and blows it away. Santa is shocked.

Back in the elf workshop, he picks up the first gift. It has the inscription ”2122”. But which elf should he give it to? Can you help him? For whom is the gift?

 

Possible Answers:

  1. Lotte
  2. Flavia
  3. Luiz
  4. Elisabeth
  5. Nathanael
  6. Matteo
  7. Evelina
  8. Mathilda
  9. Lutz
  10. Fridolin

Project Context

Agentbased models are frequently employed to model cooperative behavior. These models depict tens of thousands of independently acting entities (such as people, animals, cars, mobile phones, etc.) that interact with each other. This interaction gives rise to largescale structures describable with only a few parameters, such as the formation of groups or clusters. The extensive information in the original model can thus be condensed into a few key metrics. Conversely, it is challenging to deduce the positions of individual agents from these metrics. The mathematical formulation and computation of such relationships are the subject of current research.

Similarly, in the task, we consistently reduce long and short names to the same length. The inverse mapping, i.e., calculating the name based on the code, is nearly impossible. Unlike in agent systems, the codes have the additional property that similar names are assigned distinctly different codes. Thus, the code also serves as a checksum, enabling the detection of letter transpositions. There are many other applications for such codes, including secure password verification on a computer without the need to store the actual password.

Regarding the mathematical construction of the codes: the calculation is done based on the Adler32 hash function.