I was asked to evaluate the sum $\sum_{k = 1}^n \frac{n}{\gcd(n,k)}$ in terms of the prime factorization of $n$. I know that there are $\phi(n)$ integers $k < n$ such that $\gcd(n,k) = 1$ so I tried writting $\sum_{k = 1}^n \frac{n}{\gcd(n,k)} = \phi(n)n + 1 + S$ where $S$ is the contribution from the terms where $k < n$ and $\gcd(n,k) > 1$.
I've also tried evaluating $\sum_{k = 1}^n \frac{\text{lcm}(n,k)}{k}$ but to no avail.
I would preferably like a hint as opposed to a full solution. Any help is appreciated.