Problem: Determine which integers $n > 1$ have the property
that there exists an infinite sequence $a_1$, $a_2$, $a_3$, \dots
of nonzero integers such that the equality
\[ a_k + 2a_{2k} + \dots + na_{nk} = 0 \]
holds for every positive integer $k$.

Solution: Answer: all $n > 2$.

For $n = 2$, we have $a_k + 2a_{2k} = 0$,
which is clearly not possible,
since it implies $a_{2^k} = \frac{a_1}{2^{k-1}}$
for all $k \ge 1$.

For $n \ge 3$ we will construct a \emph{completely multiplicative} sequence
(meaning $a_{ij} = a_i a_j$ for all $i$ and $j$).
Thus $(a_i)$ is determined by its value on primes,
and satisfies the condition as long as
$a_1 + 2a_2 + \dots + na_n = 0$.
The idea is to take two large primes and use Bezout's theorem,
but the details require significant care.

We start by solving the case where $n \ge 9$.
In that case, by Bertrand postulate there exists primes $p$ and $q$ such that
\[
  \left\lceil n/2 \right\rceil < q < 2\left\lceil n/2 \right\rceil
  \quad\text{and}\quad
  \half(q-1) < p < q-1.
\]
Clearly $p \neq q$, and $q \ge 7$, so $p > 3$.
Also, $p < q < n$ but $2q > n$, and $4p \ge 4\left( \half(q+1) \right) > n$.
We now stipulate that $a_r = 1$ for any prime $r \neq p,q$
(in particular including $r=2$ and $r=3$).
There are now three cases, identical in substance.
\begin{itemize}
  \ii If $p, 2p, 3p \in [1,n]$ then we would like to
  choose nonzero $a_p$ and $a_q$ such that
  \[ 6p \cdot a_p + q \cdot a_q = 6p + q - \half n (n+1) \]
  which is possible by B\'{e}zout lemma, since $\gcd(6p,q) = 1$.

  \ii Else if $p, 2p \in [1,n]$ then we would like to
  choose nonzero $a_p$ and $a_q$ such that
  \[ 3p \cdot a_p + q \cdot a_q = 3p + q - \half n (n+1) \]
  which is possible by B\'{e}zout lemma, since $\gcd(3p, q) = 1$.

  \ii Else if $p \in [1,n]$ then we would like to
  choose nonzero $a_p$ and $a_q$ such that
  \[ p \cdot a_p + q \cdot a_q = p + q - \half n (n+1) \]
  which is possible by B\'{e}zout lemma, since $\gcd(p, q) = 1$.
  (This case is actually possible in a few edge cases,
  for example when $n=9$, $q=7$, $p=5$.)
\end{itemize}

It remains to resolve the cases where $3 \le n \le 8$.
We enumerate these cases manually:
\begin{itemize}
  \ii For $n = 3$, let $a_n = (-1)^{\nu_3(n)}$.
  \ii For $n = 4$, let $a_n = (-1)^{\nu_2(n) + \nu_3(n)}$.
  \ii For $n = 5$, let $a_n = (-2)^{\nu_5(n)}$.
  \ii For $n = 6$, let $a_n =  5^{\nu_2(n)} \cdot 3^{\nu_3(n)} \cdot (-42)^{\nu_5(n)}$.
  \ii For $n = 7$, let $a_n = (-3)^{\nu_7(n)}$.
  \ii For $n = 8$, we can choose $(p,q) = (5,7)$ in the prior construction.
\end{itemize}

This completes the constructions for all $n > 2$.