Let M=9. Consider the generating function F(x)=n≥1∑fM(n)xn=d=1∑Mk≥1∑xdk=d=1∑M1−xdxd Observe that fM(n)=fM(n+M !) for all n≥1 (in fact, all n≤0 as well). Thus fM(n) satisfies a degree m linear recurrence if and only if it eventually satisfies a degree m linear recurrence. But the latter occurs if and only if P(x)F(x) is a polynomial for some degree m polynomial P(x). Suppose P(x)F(x)=Q(x) is a polynomial for some polynomial P of degree m. We show that xs−1∣ P(x) for s=1,2,…,M, or equivalently that P(ω)=0 for all primitive s th roots of unity 1≤s≤M). Fix a primitive s th root of unity ω, and define a function Fω(z)=(1−ω−1z)s∤d≤M∑1−zdzd+s∣d≤M∑1+(ω−1z)+⋯+(ω−1z)d−1zd for all z where all denominators are nonzero (in particular, this includes z=ω ). Yet Fω(z)−F(z)(1−ω−1z)=0 for all complex z such that z1,z2,…,zM=1, so P(z)Fω(z)−Q(z)(1− ω−1z)=0 holds for all such z as well. In particular, the rational function P(x)Fω(x)−Q(x)(1−ω−1x) has infinitely many roots, so must be identically zero once we clear denominators. But no denominator vanishes at x=ω, so we may plug in x=ω to the polynomial identity and then divide out by the original (nonzero) denominators to get 0=P(ω)Fω(ω)−Q(ω)(1−ω−1ω)=P(ω)Fω(ω). However, Fω(ω)=s∣d≤M∑1+(ω−1ω)+⋯+(ω−1ω)d−1ωd=s∣d≤M∑d1 is a positive integer multiple of 1/d, and therefore nonzero. Thus P(ω)=0, as desired. Conversely, if xs−1∣P(x) for s=1,2,…,M, then P(x) will clearly suffice. So we just want the degree of the least common multiple of the xs−1 for s=1,2,…,M, or just the number of roots of unity of order at most M, which is ∑s=1Mϕ(s)=1+1+2+2+4+2+6+4+6=28.