%I #32 Dec 07 2019 12:18:23
%S 0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,
%T 1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,
%U 4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0,1,4,4,1,0
%N a(n) = n^2 mod 5.
%C Equivalently n^6 mod 5. - _Zerinvary Lajos_, Nov 06 2009
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,1).
%F From _R. J. Mathar_, Apr 20 2010: (Start)
%F a(n) = a(n-5).
%F G.f.: -x*(1+x)*(x^2+3*x+1) / ( (x-1)*(1+x+x^2+x^3+x^4) ). (End)
%t Table[Mod[n^2,5],{n,0,200}] (* _Vladimir Joseph Stephan Orlovsky_, Apr 21 2011 *)
%t PowerMod[Range[0, 200], 2, 5] (* _G. C. Greubel_, Mar 22 2016 *)
%o (Sage) [power_mod(n,2,5)for n in range(0, 101)] # _Zerinvary Lajos_, Nov 06 2009
%o (Sage) [power_mod(n,6,5)for n in range(0, 101)] # _Zerinvary Lajos_, Nov 06 2009
%o (PARI) a(n)=n^2%5 \\ _Charles R Greathouse IV_, Sep 28 2015
%Y Cf. A053879, A070431, A070432.
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_, May 12 2002