Every week, we will be releasing a new puzzle for you to solve. You may use any language you want but feel free to try something new. After completing puzzles, create a ticket on our Discord server and send us your solution. At the end of every week, we will review the problem during our meeting.
This week, you will be simulating a cryptographic handshake involving a card which unlocks a door.
The handshake used by the card and the door involves an operation that transforms a subject number. To transform a subject number, start with the value 1. Then, a number of times called the loop size, perform the following steps:
Set the value to itself multiplied by the subject number.
Set the value to the remainder after dividing the value by 20201227.
The card always uses a specific, secret loop size when it transforms a subject number. The door always uses a different, secret loop size.
The cryptographic handshake works like this:
The card transforms the subject number of 7 according to the card's secret loop size. The result is called the card's public key.
The door transforms the subject number of 7 according to the door's secret loop size. The result is called the door's public key.
The card and door use the wireless RFID signal to transmit the two public keys to the other device. Now, the card has the door's public key, and the door has the card's public key. Because you can eavesdrop on the signal, you have both public keys, but neither device's loop size.
The card transforms the subject number of the door's public key according to the card's loop size. The result is the encryption key.
The door transforms the subject number of the card's public key according to the door's loop size. The result is the same encryption key as the card calculated.
If you can use the two public keys to determine each device's loop size, you will have enough information to calculate the secret encryption key that the card and door use to communicate; this would let you send the unlock command directly to the door!
For example, suppose you know that the card's public key is 5764801. With a little trial and error, you can work out that the card's loop size must be 8, because transforming the initial subject number of 7 with a loop size of 8 produces 5764801.
Then, suppose you know that the door's public key is 17807724. By the same process, you can determine that the door's loop size is 11, because transforming the initial subject number of 7 with a loop size of 11 produces 17807724.
At this point, you can use either device's loop size with the other device's public key to calculate the encryption key. Transforming the subject number of 17807724 (the door's public key) with a loop size of 8 (the card's loop size) produces the encryption key, 14897079. (Transforming the subject number of 5764801 (the card's public key) with a loop size of 11 (the door's loop size) produces the same encryption key: 14897079.)
Your two public keys are: 15628416 & 11161639
What encryption key is the handshake trying to establish?
Week of November 16
This weekend, you head to your local grocery store to get ingredients for your thanksgiving dinner. After entering, you are given the following map:
Santa started on Floor 0 of his workshop when he started his log. Each number represents the number of floors he traveled. A positive number means that he traveled to a higher floor, while a negative number means that he traveled to a lower floor. After Santa finished his travel, he placed the gifts on the floor he ended up on.
Note that Santa's workshop has floors below Floor 0.
On what floor are the gifts located?
After completing part 1, enter your answer below to view part 2.
Enter your answer:
Week of October 26
This Saturday, you go trick or treating in your neighborhood. After a few hours, you no longer recognize any of the houses and you realize that you're lost. You see a very long street of houses and decide to get candy from that street, then find out where you are.
You ring on the door of the first house on this very long street and a witch greets you. She says,
If you have an even number of candies, you give me half your candy. But if you have an odd number of candies I triple your candy amount and then add one more.
You think this sounds a little fishy, so you turn to walk away, but the entrance is gone. Seeing no escape, you have no choice but to listen.
After making your way past this house, you notice that this was only the first of a row of 250 houses, all with the same strange deal. You must visit each house in order before exiting this strange street.
Assuming you can bring a maximum of 100,000 candies into the first house, what is the maximum number of candy you can exit with after visiting all 250 houses?
Week of October 19
A magician has a deck of 52 cards, and performs a magic trick. During the magic trick, cards are pulled out and replaced under specific conditions.
The magician checks each of these conditions in order. If the condition is satisfied, the magician performs the associated action, which may affect the next condition.
If the number of cards is even, remove 4 cards from the deck
If the number of cards is odd, remove 2 cards from the deck.
If the there are more than 30 cards in the deck, remove 1 card from the deck.
If the there are less than 20 cards in the deck, add 1 card to the deck.
Cards are removed and added from a secondary hidden pile. The number of cards in the secondary pile is unlimited. During the magic trick, the number of cards in the main deck may exceed 52.
The magician repeats this magic trick until there is only one card left in the pile. How many times does the magician perform this trick?
Week of October 12
A palindromic number is one such that written backward, its digits match that of the original value.
Examples of palindromic numbers include: 262, 27972, 62988926
Find the smallest number above 1000 that is both palindromic and prime.