Here is an interesting problem: You want to find for a fixed $j$, $1 \leq j \leq (n-s)$ the optima of the sum $\sum\limits_{k=1}^j \frac{1}{2+\gamma(s_k-2)}$ where $0<\gamma<1$, each $s_k$, $1 \leq k \leq j$, takes only positive integer (i.e. discrete) values in $1 \leq s_i \leq (n-s-(j-1))$ and $n,s$ are approprietly defined positive integers in order for the problem to make sense s.t. $n>s>0$. It also holds that $\sum\limits_{k=1}^j s_k = n-s$.
Is there a way to find the optima without using partial derivatives? I mean without taking each $s_k$ to belong to the close interval $[1, (n-s-(j-1))]$, and then restrict again to the initial domain approximating the optimal values found?
For example when $n=16$, $s=3$ and $j=4$ intuition says that the allocation of $n-s$ that makes the sum max is $s_1=s_2=s_3=1$ and $s_4=10$. While the sum is minimized when $s_1=s_2=s_3= 3$ and $s_4=4$.
In general an idea would be for someone to take cases whether $(n-s) \mod j = 0$ or not.