A053879 a(n) = n^2 mod 7.
0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1, 0, 1, 4, 2, 2, 4, 1
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,1).
Programs
-
Mathematica
Table[Mod[n^2,7],{n,0,200}] (* Vladimir Joseph Stephan Orlovsky, Apr 21 2011 *) LinearRecurrence[{0, 0, 0, 0, 0, 0, 1},{0, 1, 4, 2, 2, 4, 1},105] (* Ray Chandler, Aug 26 2015 *) PowerMod[Range[0,120],2,7] (* or *) PadRight[{},120,{0,1,4,2,2,4,1}] (* Harvey P. Dale, Sep 01 2017 *)
-
PARI
a(n)=n^2%7 \\ Charles R Greathouse IV, Jun 11 2015
Formula
Periodic with period 7.
G.f.: -x*(1+x)*(x^4 + 3*x^3 - x^2 + 3*x + 1) / ( (x-1)*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6) ). - R. J. Mathar, Feb 24 2011
Extensions
More terms from James Sellers, Apr 08 2000