> Since `a`, `b` can be equal, I wrap this list into a set to produce my
> code below.

Why not just handle this case separately?

    def last_stone(a, b, n):
        if a == b:
            return [a * (n - 1)]
        if a < b:
            return last_stone(b, a, n)
        return [i * a + (n - i - 1) * b for i in range(n)]