Python Conundrum: The Series.

While exploring an abandoned dwarven fortress, your party notices a faint glow on the wall. You put your torch on the wall and decide to look around:

enter image description here

A massive stone door! You cast a light spell to see what is the source of the glow:

enter image description here

4 keyholes and spherically cut gems above them. This must be a vault...

Beside the door there is something lying of the floor:

enter image description here

It all comes together! It seems that dwarves left the blank keys and instructions to make real keys right here in case they lose the them.

You pick up the parchment and turn it around to see this:

enter image description here

You make an impression of a blank key:

enter image description here

Now to figure out how to open the vault... At least, you hope it's a vault...

You try to insert the blank keys into all the locks and turn them, but only hear low reverberating grunts from somewhere inside the door.

That settles it. Your party needs to make keys from blanks using instructions from the parchment. You're lucky to have tools for repairing your gear with you!

The locks can be simulated with this python script:

red = ???
green = ????
blue = ????
magenta = ????

k = (red ** 2) * (green // 3 + blue) * ((blue // red) ** 2) * ((magenta - red + blue) * green) ** 2

keys = [0, 0, 0, 0]

keys[0] = 105079211 * k + 429583651070330754562479
keys[1] = 105079211 * k + 429583651070459754562279
keys[2] = 105 * k + 55275601784725866755974
keys[3] = 1198857906809595092 * k + 21051966546772674650874

for i in range(len(keys)):
    key = str(keys[i])
    for n in range(len(key)):
        if n % 2 == 0:
            char = key[:2]
            key = key[2:]
            print(chr(int(char)), end='')


1 Answer 1


Puzzle author's remark: The answer to the riddle is metal, steel, mithril or any other metal that is widely used by dwarves. The vault mechanism is not picky, as long as it's metal. If you're a dwarf, you will remember your people's ties to metalworking.

Partial answer

The black dots in the image given represent prime numbers, reading in the top row of 64 (which starts with 2, 3, and 5), then the next row (whose first prime is 67), and so on.

Grid from puzzle

The positions of the colored pixels, which are also prime, are:

red = 719
green = 1423
blue = 2237
magenta = 3709

Plugging these values into the Python code given produces a message:


Not sure where to go from here. The image of the key with 4 pins seems relevant, especially given the four-element keys list used in the Python code.

  • 2
    $\begingroup$ Given the tagging, I would guess you need to treat those four lines as a riddle. $\endgroup$
    – fljx
    Commented Oct 1, 2023 at 9:02
  • 1
    $\begingroup$ The image with the blank key is meant to hint at how to make a key. The 4 pins with 9 sections each allude to 9999 as maximum number that can be used as "blueprint" of a key. If you have the riddle already you are past the point where a blank key's impression is useful. @fljx is correct, this is a riddle and the answer is a word, as tags indicate. $\endgroup$ Commented Oct 1, 2023 at 15:19
  • 1
    $\begingroup$ It seems there is no penalty on how many times you can give the answer to the riddle so it's safe to try every word that comes to mind. $\endgroup$ Commented Oct 18, 2023 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.