OFFSET
1,2
COMMENTS
The terms of this sequence are the digital roots of the indices of those nonzero triangular numbers that are also perfect squares (A001108).
LINKS
Index entries for linear recurrences with constant coefficients, signature (0, 1, 0, 0, 0, -1, 0, 1).
FORMULA
G.f.: x*(1+8*x+3*x^2+x^3+3*x^4-x^5+x^6+9*x^7) / ((1-x)*(1+x)*(1+x^2)*(1-sqrt(3)*x+x^2)*(1+sqrt(3)*x+x^2)).
a(n) = a(n-12).
a(n) = 25-a(n-1)-a(n-6)-a(n-7).
a(n) = a(n-2)-a(n-6)+a(n-8).
a(n) = 1/4*(25+(-1)^n*(9+4*sqrt(3)*(cos(n*Pi/6)-cos(5*n*Pi/6))+2*cos(n*Pi/2))).
EXAMPLE
MATHEMATICA
LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 8, 4, 9, 7, 8, 7, 9, 4, 8, 1, 9}, 86]
LinearRecurrence[{0, 1, 0, 0, 0, -1, 0, 1}, {1, 8, 4, 9, 7, 8, 7, 9}, 86] (* Ray Chandler, Aug 03 2015 *)
PROG
(PARI) a(n)=[9, 1, 8, 4, 9, 7, 8, 7, 9, 4, 8, 1][n%12+1] \\ Charles R Greathouse IV, Jul 17 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ant King, Jan 23 2012
STATUS
approved