OFFSET
1,2
COMMENTS
The terms of this sequence are the units' digits of the indices of those nonzero triangular numbers that are also perfect squares (A001108).
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0, 0, 0, 0, 0, 1).
FORMULA
G.f.: x*(1+7x+x^2) / ((1-x)*(1+x)*(1-x+x^2)).
a(n) = a(n-6) for n>6.
a(n) = 9-a(n-3) for n>3.
a(n) = a(n-1) - a(n-3) + a(n-4) for n>4.
a(n) = 1/6*(27+(-1)^n*(5-32*cos(2*n*Pi/3))).
EXAMPLE
MAPLE
A205185:=n->[1, 8, 9, 8, 1, 0][(n mod 6)+1]: seq(A205185(n), n=0..100); # Wesley Ivan Hurt, Jun 18 2016
MATHEMATICA
LinearRecurrence[{0, 0, 0, 0, 0, 1}, {1, 8, 9, 8, 1, 0}, 86]
PadRight[{}, 100, {1, 8, 9, 8, 1, 0}] (* Vincenzo Librandi, Jun 19 2016 *)
PROG
(Magma) &cat[[1, 8, 9, 8, 1, 0]: n in [0..20]]; // Wesley Ivan Hurt, Jun 18 2016
(PARI) a(n)=[0, 1, 8, 9, 8, 1][n%6+1] \\ Charles R Greathouse IV, Jul 17 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ant King, Jan 24 2012
STATUS
approved