## Let $n$ be a positive integer. Suppose there are stations at the coordinates $(x, y) = (2^i \bmod n, 3^i \bmod n)$ for $0 \leq i \leq 2n$. We will consider stations with the same coordinates as the same station.

We wish to form a path from $(0, 0)$ to $(n, n)$ such that the $x$ and $y$ coordinates never decrease.

Let $S(n)$ be the maximum number of stations such a path can pass through.

For example, if $n = 22$, there are $11$ distinct stations, and a valid path can pass through at most $5$ stations. Therefore, $S(22) = 5$.

The case is illustrated below, with an example of an optimal path:

It can also be verified that $S(123) = 14$ and $S(10000) = 48$.

Find $\sum S(k^5)$ for $1 \leq k \leq 30$.

### This problem appears to be a problem from Project Euler (Problem 616). As of now, there is no general formula to solve this problem. A lot of number theory, specifically knowledge of modulo properties, should be applied here. Without knowing the property of $2^i$ and $3^i$ mod $n$, it would really be hard to come up with a neat solution.

Due to the high level of mathematical complexity, large computations, and the need for specific knowledge or intuition of special properties in number theory that are not typical, a detailed answer cannot be provided here.

A simplified analytical approach would be:

1. Identify the different stations,

2. Identify possible paths from (0,0) to (n,n),

3. Determine the maximum number of stations such a path can pass through.

However, these steps involve numerous computations that need to be performed for each $k^5$ from 1 to 30 and summed, which in practice would likely require the use of a computer and an understanding of programming as well as advanced mathematics.

Additionally, this kind of problem could be potentially solved with dynamic programming or other algorithmic techniques, and the properties of exponential modulo computations could perhaps be used to simplify the problem or the computations required.

We would recommend you to visit math forums or use tools like Wolfram Alpha to deal with this kind of high complexity math problems.

##### More Answers:

Admissible Paths Through a GridNim Extreme

Circle and Tangent Line