Problem 1
You are given an integer sequence of length $n$. Compute:
$$\sum\limits_{i = 1}^n\sum\limits_{j = i}^n \gcd\left\{a_i, a_{i + 1}, \ldots, a_j\right\}$$
$1 \leq n \leq 2 \times 10^5$
Problem 2
You are given an integer sequence of length $n$. Compute:
$$\sum\limits_{i = 1}^n\sum\limits_{j = i}^n \gcd\left\{a_i, a_{i + 1}, \ldots, a_j\right\} \cdot \max\left\{a_i, a_{i + 1}, \ldots, a_j\right\}$$
$1 \leq n \leq 2 \times 10^5$
Problem 3
给定整数 $n, L, R$,长度都为 $n$ 的数组 $a$ 和 $b$。选择一段长度在 $\left[L, R\right]$ 的区间,使得 $\dfrac{\sum a}{\sum b}$ 最大,求最大值。
$1 \leq n \leq 10^5$
Problem 4
Consider a large number of length $n$, written as $\overline{S_1 S_2 S_3 \cdots S_n}$, where $S_i$ denotes the $i$-th digit of the number, and $S_1$ is the most significant digit.
You are given several constraints. Each constraint is represented by four integers $\left(l_1, r_1, l_2, r_2\right)$, describing two intervals of equal length. The constraint means that the substring $\overline{S_{l_1} S_{l_1+1} \cdots S_{r_1}}$
is exactly the same as the substring $\overline{S_{l_2} S_{l_2+1} \cdots S_{r_2}}$.
For example, when $n = 6$, if a constraint is $\left(l_1 = 1, r_1 = 3, l_2 = 4, r_2 = 6\right)$, then numbers like 123123 and 351351 satisfy the constraint, but 12012 and 131141 do not: the former is not of length 6, and in the latter the 2nd digit differs from the 5th digit.
Question: How many length-$n$ numbers satisfy all of the given constraints?
$1 \leq n \leq 10^5$