I am trying to find an equation for finding the coefficient of the $k$th term of the expansion of $\left(\frac{x^n - 1}{x - 1}\right)^m$ for any $n$, $m$, and $k$.
So, far I've managed to find A277950 the terms for $m = 5$. I however have not been able to figure out what $k$ is in their formula for the sequence, and I can't find a way to generalize it for $m \neq 5$.
I have similarly written a python program to find the coefficients, which works by looping through the integers in $[1, n]$, $m$ times and then counting the number of times each number appears. Printing the number of time each number appears in order yields the coefficients of the expansion. I have no idea why this is working, but for every set of numbers I've tried it has worked correctly.