OFFSET
1,1
COMMENTS
Numbers == 2, 4, 5 or 7 mod 9, i.e. such that n^4 is not congruent to n^2 mod 9.
Numbers congruent to {2, 4, 5, 7} mod 9.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1, 0, 0, 1, -1).
FORMULA
a(n) = a(n-1) + a(n-4) - a(n-5) for n>5. - Harvey P. Dale, Apr 05 2015
From Colin Barker, Dec 19 2017: (Start)
G.f.: x*(2 + 2*x + x^2 + 2*x^3 + 2*x^4) / ((1 - x)^2*(1 + x)*(1 + x^2)).
a(n) = (-9 + (-1)^(1+n) - (3-3*i)*(-i)^n - (3+3*i)*i^n + 18*n) / 8 where i=sqrt(-1).
(End)
EXAMPLE
a(1)=2 because iteration starts 2, 4, 7, 13, 16, 13, 16, ....
MATHEMATICA
Flatten[Table[9n+{2, 4, 5, 7}, {n, 0, 20}]] (* or *) LinearRecurrence[{1, 0, 0, 1, -1}, {2, 4, 5, 7, 11}, 100] (* Harvey P. Dale, Apr 05 2015 *)
PROG
(PARI) Vec(x*(2 + 2*x + x^2 + 2*x^3 + 2*x^4) / ((1 - x)^2*(1 + x)*(1 + x^2)) + O(x^80)) \\ Colin Barker, Dec 19 2017
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Henry Bottomley, Jun 19 2000
STATUS
approved