This sum popped out in some of the work I have been doing, and I have been trying to analyze it asymptotically as $n$ approaches infinity, $$S=k^n+\sum_{i=1}^n\frac{1}{i}\sum_{d|i}\phi(d) k^{i/d}.$$ In this equation $\phi(d)$ is the Euler totient function, and $\sum_{d|i}$ means we are summing over all divisors $d$ of $i$, and $k\in \mathbb{N}$.
Since $k^n$ is the largest term in $S$, we have $S=\Theta(k^n)$, but I want to do better since it doesn't really tell me how big the coefficient in front of $k^n$ is as $n$ goes to infinity. If we look at the double sum, we get $$\sum_{i=1}^n\frac{1}{i}\sum_{d|i}\phi(d) k^{i/d}\sim \sum_{i=1}^n\frac{1}{i}k^{i} = \Theta\bigg(\frac{k^n}{n}\bigg) $$ So can we say that $$S\sim k^n+\frac{k^n}{n} = \bigg(\frac{n+1}{n}k^n\bigg) = (1+o(1))k^n.$$ Is this right? It doesn't feel right doing that, but I don't know exactly what feels wrong.