Problem 411

Problem 411

Uphill paths

Let n be a positive integer. Suppose there are stations at the coordinates (x, y) = (2i mod n, 3i mod n) for 0 ≤ i ≤ 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 ∑ S(k5) for 1 ≤ k ≤ 30.


记n为正整数。在所有坐标为(x, y) = (2i mod n, 3i mod n)的位置安设站点,其中0 ≤ i ≤ 2n。如果多个站点有相同坐标,我们就合并为同一个站点。

我们希望找到一条从(0, 0)到(n, n)的路径,路径上x和y坐标单调不减。

例如,当n = 22时,一共有11个不同的站点,一条可行路径最多能穿过5个站点,因此S(22) = 5。如下图所示是其中一条最优的可行路径:

同样可以验证S(123) = 14以及S(10000) = 48。

对于1 ≤ k ≤ 30,求∑ S(k5)。