login
a(n) = n^2 mod 7.
10

%I #60 Dec 14 2023 05:23:11

%S 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,

%T 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,

%U 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

%N a(n) = n^2 mod 7.

%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,1).

%F Periodic with period 7.

%F 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

%t Table[Mod[n^2,7],{n,0,200}] (* _Vladimir Joseph Stephan Orlovsky_, Apr 21 2011 *)

%t LinearRecurrence[{0, 0, 0, 0, 0, 0, 1},{0, 1, 4, 2, 2, 4, 1},105] (* _Ray Chandler_, Aug 26 2015 *)

%t PowerMod[Range[0,120],2,7] (* or *) PadRight[{},120,{0,1,4,2,2,4,1}] (* _Harvey P. Dale_, Sep 01 2017 *)

%o (PARI) a(n)=n^2%7 \\ _Charles R Greathouse IV_, Jun 11 2015

%Y Cf. A070430, A070431.

%K nonn,easy

%O 0,3

%A Stuart M. Ellerstein (ellerstein(AT)aol.com), Apr 01 2000

%E More terms from _James A. Sellers_, Apr 08 2000