The sum of the elements of the powers of a matrix