VP 58: Frequencies (30 extra)

What You Need

Any computer with Python 3. You can also use an online Python environment, such as https://colab.research.google.com

Problem Statement

A radio device must be calibrated--its frequency is incorrect.

Your input data is a list of frequency changes. A value like +6 means the current frequency increases by 6; a value like -3 means the current frequency decreases by 3.

For example, if the device displays frequency changes of +1, -2, +3, +1, then starting from a frequency of zero, the following changes would occur:

In this example, the resulting frequency is 3.

Here are other example situations:

VP 58.1: Frequency Shift (15 pts)

Use this data:
https://samsclass.info/COMSC122/proj/VP58
Starting with a frequency of zero, what is the resulting frequency after all of the changes in frequency have been applied?

That number is the flag.

Part 2: Duplicated Frequency

Now you need to find the first frequency it reaches twice. After processing the entire list of changes, just repeat the whole list again, as many times as required.

For example, if the device displays frequency changes of +1, -2, +3, +1, the device would loop as follows:

(At this point, the device continues from the start of the list.) In this example, the first frequency reached twice is 2. Note that your device might need to repeat its list of frequency changes many times before a duplicate frequency is found, and that duplicates might be found while in the middle of processing the list.

Here are other examples:

VP 58.2: Duplicated Frequency (15 pts)

Use the same data:
https://samsclass.info/COMSC122/proj/VP58
What is the first frequency your device reaches twice?

That number is the flag.

Hint: you will need to perform more than 100,000 frequency adjustments.

Source

Adapted from the Advent of Code.

Posted 11-3-25