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'll be executing a series of instructions on a 1000x1000 light grid.
Lights in your grid are numbered from 0 to 999 in each direction; the lights at each corner are at 0,0, 0,999, 999,999, and 999,0. The instructions include whether to turn on, turn off, or toggle various inclusive ranges given as coordinate pairs. Each coordinate pair represents opposite corners of a rectangle, inclusive; a coordinate pair like 0,0 through 2,2 therefore refers to 9 lights in a 3x3 square. The lights all start turned off.
To defeat your neighbors this year, all you have to do is set up your lights by doing the instructions Santa sent you in order.
"turn on 0,0 through 999,999" would turn on (or leave on) every light.
"toggle 0,0 through 999,0" would toggle the first line of 1000 lights, turning off the ones that were on, and turning on the ones that were off.
"turn off 499,499 through 500,500" would turn off (or leave off) the middle four lights.
After following the instructions, how many lights are lit?
turn on 489,959 through 759,964
turn off 820,516 through 871,914
turn off 427,423 through 929,502
turn on 774,14 through 977,877
turn on 410,146 through 864,337
turn on 931,331 through 939,812
turn off 756,53 through 923,339
turn off 313,787 through 545,979
turn off 12,823 through 102,934
toggle 756,965 through 812,992
turn off 743,684 through 789,958
toggle 120,314 through 745,489
toggle 692,845 through 866,994
turn off 587,176 through 850,273
turn off 674,321 through 793,388
toggle 749,672 through 973,965
turn on 943,30 through 990,907
turn on 296,50 through 729,664
turn on 212,957 through 490,987
toggle 171,31 through 688,88
turn off 991,989 through 994,998
turn off 913,943 through 958,953
turn off 278,258 through 367,386
toggle 275,796 through 493,971
turn off 70,873 through 798,923
toggle 258,985 through 663,998
turn on 601,259 through 831,486
turn off 914,94 through 941,102
turn off 558,161 through 994,647
turn on 119,662 through 760,838
toggle 378,775 through 526,852
turn off 384,670 through 674,972
turn off 249,41 through 270,936
turn on 614,742 through 769,780
turn on 427,70 through 575,441
turn on 410,478 through 985,753
Week of February 2
This week, you will be driving a ship across an ocean by following detailed instructions left by the coast guard.
Each instruction begins with a letter code followed by a number, indicating the action that is to be performed.
N - move North a number of units
S - move South a number of units
E - move East a number of units
W - move West a number of units
L - turn left a number of degrees
R - turn right a number of degrees
F - move forward in the direction you are facing a number of units
Your ship starts facing east at position (0,0).
After completing all your instructions, what position do you end up at?
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.