%I #51 Sep 08 2022 08:44:37
%S 0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,
%T 4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,0,1,2,
%U 3,4,0,1,2,3,4,0,1,2,3,4,0
%N a(n) = n mod 5.
%C Complement of A002266, since 5*A002266(n) + a(n) = n. - _Hieronymus Fischer_, Jun 01 2007
%H Muniru A Asiru, <a href="/A010874/b010874.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,1).
%F Complex representation: a(n) = (1/5)*(1-r^n)*Sum{1<=k<5, k*Product{1<=m<5,m<>k, (1-r^(n-m))}} where r=exp(2*Pi/5*i) and i=sqrt(-1).
%F G.f.: g(x)=(4*x^4+3*x^3+2*x^2+x)/(1-x^5). - _Hieronymus Fischer_, May 29 2007
%F Trigonometric representation: a(n) = (16/5)^2*(sin(n*Pi/5))^2*Sum{1<=k<5, k*Product{1<=m<5,m<>k, (sin((n-m)*Pi/5))^2}}. Clearly, the squared terms may be replaced by their absolute values '|.|'. This formula can be easily adapted to represent any periodic sequence.
%F G.f.: also g(x) = x*(5*x^6 - 6*x^5 + 1)/((1-x^5)*(1-x)^2). - _Hieronymus Fischer_, Jun 01 2007
%F a(n) = -cos(4/5*Pi*n)-cos(2/5*Pi*n)+1/20*5^(1/2)*(10-2*5^(1/2))^(1/2)* sin(4/5*Pi*n)-1/4*(10-2*5^(1/2))^(1/2)*sin(4/5*Pi*n)-1/4*(10+2*5^(1/2))^(1/2)*sin(2/5*Pi*n)-1/20*5^(1/2)*(10+2*5^(1/2))^(1/2)*sin(2/5*Pi*n) + 2. - _Leonid Bedratyuk_, May 14 2012
%F a(n) = floor(1234/99999*10^(n+1)) mod 10. - _Hieronymus Fischer_, Jan 03 2013
%F a(n) = floor(97/1562*5^(n+1)) mod 5. - _Hieronymus Fischer_, Jan 04 2013
%F From _Wesley Ivan Hurt_, Jul 23 2016: (Start)
%F a(n) = a(n-5) for n>4.
%F a(n) = 4*(1 - floor(n/5)) + Sum_{k=1..4} floor((n-k)/5).
%F a(n) = 4 - 4*floor(n/5) + floor((n-1)/5) + floor((n-2)/5) + floor((n-3)/5) + floor((n-4)/5).
%F a(n) = n - 5*floor(n/5). (End)
%F a(n) = 2 + (2/5)*Sum_{k=1..4} k*((cos(2*(n-k)*Pi/5) + cos(4*(n-k)*Pi/5)). - _Wesley Ivan Hurt_, Sep 27 2018
%p seq(chrem( [n,n], [1,5] ), n=0..80); # _Zerinvary Lajos_, Mar 25 2009
%t Mod[Range[0, 100], 5] (* _Wesley Ivan Hurt_, Jul 23 2016 *)
%o (PARI) a(n)=n%5 \\ _Charles R Greathouse IV_, Sep 24 2015
%o (Magma) [n mod 5 : n in [0..100]]; // _Wesley Ivan Hurt_, Jul 23 2016
%o (GAP) List([0..100],n->n mod 5); # _Muniru A Asiru_, Sep 28 2018
%Y Partial sums: A130483.
%Y Cf. A130481, A130482, A130484, A130485, A004526, A002264, A002265, A002266.
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_