A070430 a(n) = n^2 mod 5.
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, 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, 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
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,1).
Programs
-
Mathematica
Table[Mod[n^2,5],{n,0,200}] (* Vladimir Joseph Stephan Orlovsky, Apr 21 2011 *) PowerMod[Range[0, 200], 2, 5] (* G. C. Greubel, Mar 22 2016 *)
-
PARI
a(n)=n^2%5 \\ Charles R Greathouse IV, Sep 28 2015
-
Sage
[power_mod(n,2,5)for n in range(0, 101)] # Zerinvary Lajos, Nov 06 2009
-
Sage
[power_mod(n,6,5)for n in range(0, 101)] # Zerinvary Lajos, Nov 06 2009
Formula
From R. J. Mathar, Apr 20 2010: (Start)
a(n) = a(n-5).
G.f.: -x*(1+x)*(x^2+3*x+1) / ( (x-1)*(1+x+x^2+x^3+x^4) ). (End)
Comments