login
a(n) = n^2 mod 9.
5

%I #42 Nov 29 2022 06:00:05

%S 0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,

%T 4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,

%U 7,0,4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,4,1,0,1,4,0,7,7,0,4,1,0,1

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

%C Also decimal expansion of 4692347/333333333. - _Enrique Pérez Herrero_, Nov 27 2022

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

%F From _R. J. Mathar_, Apr 20 2010: (Start)

%F a(n) = a(n-9).

%F G.f.: ( -x*(1+x)*(x^6+3*x^5-3*x^4+10*x^3-3*x^2+3*x+1) ) / ( (x-1)*(1+x+x^2)*(x^6+x^3+1) ). (End)

%F a(n) = A010878(A000290(n)) = A010878(n^2). - _Enrique Pérez Herrero_, Nov 27 2022

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

%t PowerMod[Range[0,200],2,9] (* _Harvey P. Dale_, Jun 11 2011 *)

%o (PARI) a(n)=[0,1,4,0,7,7,0,4,1][n%9+1] \\ _Charles R Greathouse IV_, Jun 11 2011

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

%Y Cf. A000290, A010878, A053879, A070430, A070431.

%K nonn,easy

%O 0,3

%A _N. J. A. Sloane_, May 12 2002