login
a(n) = n^2 mod 20.
13

%I #41 Dec 27 2023 11:54:36

%S 0,1,4,9,16,5,16,9,4,1,0,1,4,9,16,5,16,9,4,1,0,1,4,9,16,5,16,9,4,1,0,

%T 1,4,9,16,5,16,9,4,1,0,1,4,9,16,5,16,9,4,1,0,1,4,9,16,5,16,9,4,1,0,1,

%U 4,9,16,5,16,9,4,1,0,1,4,9,16,5,16,9,4,1,0,1,4,9,16,5,16,9,4,1,0,1,4,9,16

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

%C Also, n^6 mod 20.

%C Equivalently n^10 mod 20. - _Zerinvary Lajos_, Oct 31 2009

%H G. C. Greubel, <a href="/A070442/b070442.txt">Table of n, a(n) for n = 0..1000</a>

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

%F From _Reinhard Zumkeller_, Apr 24 2009: (Start)

%F a(m*n) = a(m)*a(n) mod 20.

%F a(5*n+k) = a(5*n-k) for k <= 5*n.

%F a(n+10) = a(n). (End)

%F G.f. -x*(1+4*x+9*x^2+16*x^3+5*x^4+16*x^5+9*x^6+4*x^7+x^8) / ( (x-1) *(1+x) *(x^4+x^3+x^2+x+1) *(x^4-x^3+x^2-x+1) ). - _R. J. Mathar_, Aug 27 2013

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

%t LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 1},{0, 1, 4, 9, 16, 5, 16, 9, 4, 1},95] (* _Ray Chandler_, Aug 26 2015 *)

%t PowerMod[Range[0,100],2,20] (* or *) PadRight[{},120,{0,1,4,9,16,5,16,9,4,1}] (* _Harvey P. Dale_, Jan 06 2019 *)

%o (Sage) [power_mod(n,10,20) for n in range(0, 88)] # _Zerinvary Lajos_, Oct 31 2009

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

%Y Cf. A000290, A008959, A010382, A070431, A070435, A070438, A070452, A159852.

%Y Row 20 of A048152.

%K nonn,easy

%O 0,3

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