Welcome, Agent!

For years, the digits of ฯ€ have been considered random. Chaotic. Patternless. Infinite. But someone (or something) has started using them. A signal has been intercepted inside the Pi Archive Network. The source identifies itself only as ฯ€-Ghost. The signal is unstable, fragmented, encoded. Your mission: decode the ghost signal and uncover the truth.

Part 1: The intercepted signal

The first fragment of the transmission appears as nothing more than pulses. Dots. Dashes. Pauses. At first glance it resembles Morse code, but something about the rhythm is wrong. The pauses between symbols do not follow the standard Morse timing. Instead, they follow a strange pattern based on the digits of ฯ€.

A pause of 3 time units separates letters. However, words are separated by pauses of 1 or 4 units. These word gaps alternate: 1 unit, then 4 units, then 1, then 4...

Below is the raw signal. Each dot (โ€ข) and dash (โˆ’) is followed by a pause whose length corresponds to the next digit of ฯ€. Your task is to reconstruct the true Morse message.

Important: When decoding, any characters that are not letters or numbers (such as punctuation marks or symbols) should be preserved exactly as they appear in the transmission and passed through without modification.

Example

To understand the timing, consider the following example with different rules:

  • Letters are separated by pauses of 2 units.
  • Words are separated by pauses alternating between 5 and 6 units.

Raw Morse signal:

....  .  -.--  ,     -..  ..  -..      -.--  ---  ..-     -.-  -.  ---  .--      -  ....  .-  -     ฯ€  --.  ....  ---  ...  -      .-..  ---  ...-  .  ...     .--.  ..  .  ...  ?

Using the rule above, the decoded message would be:

Hey, did you know that ฯ€ Ghost loves pies?

Decoded the following message and reveal a passcode that you must write below.

--.   .-.   ..   -..   : -.   -..-   -.
-.    = .----   -----   -----

...   .   .   -..   :    .--.   .. -..   ..   --.   ..   -   ...

-.-.   ---   -.   ...   -   .-.   ..-   -.-.   -    -   ....   . --.   .-.   ..   -..    ..-   ...   ..   -.   --. -   ....   .    ..-.   ..   .-.   ...   - .----   -----   -----   -----   -----    -..   ..   --.   ..   -   ... ---   ..-.    .--.   ..
-...   .   --.   ..   -. .-   -    (   -----   ,   -----   )
.-.   .   .-   -.-.   .... (   ----.   ----.   ,   ----.   ----.   )

.--.   .-   ...   ...   -.-.   ---   -..   .   :    .--.   ..   --.-   ..---   -----   ..---   -....

--   ---   ...-   .   --   .   -.   - .-   .-..   .-..   ---   .--   .   -..    ..   -. ..-.   ---   ..-   .-.    -..   ..   .-.   .   -.-.   -   ..   ---   -.   ...
-.-.   ---   ...   - -..   .   .--.   .   -.   -..   ...    ---   -. -   ....   .    --   ---   .-.   ...   . ---   ..-.    -   ....   . -..   ..   --.   ..   -
Part 2: Navigating the grid

The signal you reconstructed was not merely a message. It was a set of instructions. ฯ€-Ghost has embedded a navigation puzzle inside the digits of ฯ€ themselves. Using the parameters obtained from the intercepted transmission, you must construct a grid and determine the most efficient path through it.

1. Build the grid

Create a square grid of size n ร— n, where n is the value revealed in the decoded message. Fill the grid row by row using the digits of ฯ€. Ignore the dot that separates the integer from the decimals.

2. Determine the cost of each cell

Each digit in the grid has an associated movement cost derived from the Morse representation of that digit.

cost = 3 ร— (number of dashes) + 1 ร— (number of dots) + digit

3. Find the most efficient path

Your objective is to travel from the top-left corner of the grid (0,0) to the bottom-right corner (nโˆ’1,nโˆ’1). You may only move in the four cardinal directions:

  • Right
  • Down
  • Left
  • Up

The total cost of a path is the sum of the costs of all cells visited, including the starting and ending cells.

Important: If two or more paths have exactly the same total cost, you must resolve the tie using the following priority rule when choosing the next move:

Right โ†’ Down โ†’ Left โ†’ Up

This priority rule should only be applied when multiple paths have identical costs and a deterministic choice must be made.

4. Generate the passcode

Once the optimal path is found, compute:

passcode = (minimum path cost) ร— (length of the path)

The length of the path is the total number of cells visited, including the starting and ending cells. The resulting value is the next passcode.

Example

The following example demonstrates the process using a small grid and a different cost formula purely for illustration. The values below do not correspond to the real puzzle formula.

Example grid built from ฯ€:

ฯ€ = 3.1415926535...

4ร—4 grid

3 1 4 1
5 9 2 6
5 3 5 8
9 7 9 3

For this example we will use the following placeholder formula:

example_cost = 2 ร— (number of dashes) + 4 ร— (number of dots) โˆ’ digit

Applying that example formula could produce the following cost grid:

Example cost grid

13 11 14 11
15  3 12 12
15 13 15  6
 3  9  3 13

One possible path could be:

(0,0) โ†’ (1,0) โ†’ (1,1) โ†’ (1,2) โ†’ (1,3) โ†’ (2,3) โ†’ (3,3)

Total cost of this path:

13 + 11 + 3 + 13 + 9 + 3 + 13 = 65

Path length:

7 cells

Example passcode calculation:

passcode = 65 ร— 7 = 455

Important note: the last digit of Pi in the N-digits requested is 8... not 7.

Congratulations! You've uncovered the Ghost Signal. Happy Pi Day 2026!

Support Pi Coding Quest

If you enjoy these coding challenges and would like to support future development, please consider making a donation.

Did you enjoy solving this quest?

Challenge other people to solve it by sharing it. If you have any feedback, feel free to drop me a message hi@ivanr3d.com, I would like to know your experience!