OFFSET
1,2
COMMENTS
The terms of this sequence are the units' digits of the nonzero square triangular numbers.
The coefficients of x in the numerator of the generating function are the terms that constitute the periodic cycle of the sequence.
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+6*x+5*x^2+6*x^3+x^4) / ((1-x)*(1+x)*(1-x+x^2)*(1+x+x^2)).
a(n) = a(n-6) for n>6.
a(n) = 19 - a(n-1) - a(n-2) - a(n-3) - a(n-4) - a(n-5) for n>5.
a(n) = (1/3)*(sin(n*Pi/6))^2*(57+76*cos(n*Pi/3)+58*cos(2*n*Pi/3)+44*cos(n*Pi)+20*cos(4*n*Pi/3)).
a(n) = (1/45)*(17*(n mod 6)+47*((n+1) mod 6)+2*((n+2) mod 6)+17*((n+3) mod 6)-28*((n+4) mod 6)+2*((n+5) mod 6)). - Bruno Berselli, Jan 24 2012
EXAMPLE
The fourth nonzero square triangular number is 41616. As this has units' digit 6, we have a(4) = 6.
MAPLE
A185273:=n->[1, 6, 5, 6, 1, 0][(n mod 6)+1]: seq(A185273(n), n=0..100); # Wesley Ivan Hurt, Jun 18 2016
MATHEMATICA
LinearRecurrence[{0, 0, 0, 0, 0, 1}, {1, 6, 5, 6, 1, 0}, 86]
PadRight[{}, 120, {1, 6, 5, 6, 1, 0}] (* Harvey P. Dale, Sep 22 2015 *)
PROG
(Magma) &cat[[1, 6, 5, 6, 1, 0]^^20]; // Wesley Ivan Hurt, Jun 18 2016
(PARI) a(n)=[0, 1, 6, 5, 6, 1][n%6+1] \\ Charles R Greathouse IV, Jul 17 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ant King, Jan 24 2012
STATUS
approved