Continued fractions and linear recurrences