The Automatic Solution of Recurrence Relations. I. Linear Recurrences of Finite Order with Constant Coefficients