You were recently caught trespassing on the queen's hunting grounds. The punishment for this crime is a miserable experience the locals call the maze of everlasting flowers:
The full resolution of the image is 4K, so if the local version is hard to read, click it to open the full resolution version. Additionally, for those who are curious but don't want to look it up, 花 is the Japanese kanji for flower, and is pronounced hänä.
Maze Regions
There are seven total regions in the maze; they are the starting and escape regions (denoted by S and 花 respectively), along with individual regions labeled $1$ through $5$. The starting point for each region is denoted its symbol; S, 花, $1$, $2$, $3$, $4$, and $5$ respectively.
The Key to Freedom
Before being placed in the maze, you are given a magical key with the letter $n$ etched into it. Upon entering the starting region of the maze, you may choose any number to replace this etching of $n$. Choose wisely though, for once you leave the starting region, each region will change the number on your key, by summing the digits of the number you entered the region with (from this point forward, this is referred to as transformation). For example, if the number on your key is $52$ upon entering a region, your number will change to $7$ since $5 + 2 = 7$.
For clarity, the key is exempt from transformation in the starting and escape regions only.
In order to keep chosen values within the constraints of the puzzle, starting numbers should be restricted to those who's digits produce a sum of 5 digits in length or less. While numbers that would produce this result are astronomical in size, be sure to test your value first as there are only 5 sections in the puzzle you can navigate to.
Portals
There are various portals throughout the maze represented by a flower 🌸 image. These portals will transport you between regions, but the destination is dependent on the number etched into your key after transformation. To elaborate, if the number etched into your key is a two digit number, any portal you travel through will transport you to region $2$.
For example; let's say you enter region $3$ with the number $553$ etched into your key. The transformation caused by entering the region changes this number to $13$ since $5 + 5 + 3 = 13$. This means that the next portal you traverse through will transport you to region $2$ since $13$ only has two digits.
Escaping the Maze
Your escape relies on two factors:
- The number etched into your key after the transformation caused by entering region $1$.
- Henceforth referred to as simply $r$.
- The number of total number of turns at the time of reaching a portal in region $1$.
- Henceforth referred to as simply $t$.
To clarify the second factor, let's say you enter region $1$ with a current total of $28$ turns. If you go for the portal that requires the least amount of turns from the entry point of region $1$, your total upon reaching the portal will be $31$.
Can you Escape?
To succeed in escaping the maze, the following equation must be true with respect to the image (e.g. $\Delta = 9$):
$$\Delta = \Biggl(\frac{t \mod 6}{(t \mod r) + 1}\Biggr)^2$$
For example, assuming $t = 43$ and $r = 4$, your freedom is denied and as a result you are transported back to the start of the maze where the whole process starts over.
What Counts as a Turn?
To ensure that everyone understands what counts as a "turn" in an answer, a turn is defined as the movement from one corridor to another where there is a visually distinct 90 degree angle in the maze. For example, the starting point for region $4$ can start a path down two corridors without the cost of a turn. To demonstrate this visually, I've drawn (quite terribly), a few routes in the maze:
In this example, a "turn" is a 90 degree (for clarity, actual angle doesn't matter) bend in the drawn line. As a result, the white line from the start of region $4$ to the top left flower counts as a zero turn path.
Visually Blended Regions
Upon close inspection, you'll notice that regions $2$, $3$, and $5$ are visually blended, in that they do not have any borders preventing you from traversing between them at will. However, this is not the case. Consider these regions as different "levels" of the same portion of the maze. For example, if the last portal you traversed through sent you to region $2$, you are in region $2$ until you traverse through another portal.
The poor souls that receive this terrible punishment are unfortunately destined to wander for all eternity. Can you escape?
Additional tags include no-computers and mathematics.