%I #25 Sep 08 2022 08:45:55
%S 1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,
%T 1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6,
%U 5,6,1,0,1,6,5,6,1,0,1,6,5,6,1,0,1,6
%N Period 6: repeat [1, 6, 5, 6, 1, 0].
%C The terms of this sequence are the units' digits of the nonzero square triangular numbers.
%C The coefficients of x in the numerator of the generating function are the terms that constitute the periodic cycle of the sequence.
%H Vincenzo Librandi, <a href="/A185273/b185273.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,1).
%F 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)).
%F a(n) = a(n-6) for n>6.
%F a(n) = 19 - a(n-1) - a(n-2) - a(n-3) - a(n-4) - a(n-5) for n>5.
%F 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)).
%F 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
%e The fourth nonzero square triangular number is 41616. As this has units' digit 6, we have a(4) = 6.
%p A185273:=n->[1, 6, 5, 6, 1, 0][(n mod 6)+1]: seq(A185273(n), n=0..100); # _Wesley Ivan Hurt_, Jun 18 2016
%t LinearRecurrence[{0, 0, 0, 0, 0, 1}, {1, 6, 5, 6, 1, 0}, 86]
%t PadRight[{}, 120, {1,6,5,6,1,0}] (* _Harvey P. Dale_, Sep 22 2015 *)
%o (Magma) &cat[[1, 6, 5, 6, 1, 0]^^20]; // _Wesley Ivan Hurt_, Jun 18 2016
%o (PARI) a(n)=[0, 1, 6, 5, 6, 1][n%6+1] \\ _Charles R Greathouse IV_, Jul 17 2016
%Y Cf. A001110.
%K nonn,easy
%O 1,2
%A _Ant King_, Jan 24 2012