How to find a sequence that maximizes a ratio Given positive parameters $n$, $P$ and $Q$, what is a sequence $a_1,\dots,a_n$ such that for every $k$:
$$
\frac{1}{k}\leq a_k \leq 1
$$
which maximizes the ratio:
$$
R = \frac{P + \sum_{k=1}^n a_k}{Q + \sum_{k=1}^n k\cdot a_k}
$$
?
NOTE: one observation is that a maximizing sequence should be weakly decreasing (for all $k>l$, $a_k\leq a_l$). PROOF: If there exists $k>l$ with $a_k>a_l$, then switch $a_k$ with $a_l$. This strictly decreases the denominator but does not change the nominator.

Suppose we have the optimal sequence $\{a_i\}$. Then $a_1=1$. Also, if $\frac{1}{k}\lt a_k \lt 1$ for some $k$, then a small perturbation ϵ in $a_k$ reduces the required ratio $R$. Now write$$R_m=\frac{N}{M}$$
where $R_m$ is the value of the ratio for the optimal sequence $\{a_i\}$. Then $$R_\epsilon=\frac{N+\epsilon}{M+k\epsilon}.$$
From the condition $R_m−R_ϵ>0$, we have $$N k \epsilon>\epsilon M.$$
Since a perturbation is possible in both directions for $a_k$, the inequality is a contradiction.
Your observation that the sequence is weakly decreasing is crucial here. For, if suppose that  $a_1 = a_2 = .. a_{k-1} =1$ and $a_k=\frac{1}{k}$, then $a_t = \frac{1}{t}$ for $t>k$ is forced by the above argument.
