A010874 a(n) = n mod 5.
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, 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, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0
Offset: 0
Links
- Muniru A Asiru, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,1).
Crossrefs
Programs
-
GAP
List([0..100],n->n mod 5); # Muniru A Asiru, Sep 28 2018
-
Magma
[n mod 5 : n in [0..100]]; // Wesley Ivan Hurt, Jul 23 2016
-
Maple
seq(chrem( [n,n], [1,5] ), n=0..80); # Zerinvary Lajos, Mar 25 2009
-
Mathematica
Mod[Range[0, 100], 5] (* Wesley Ivan Hurt, Jul 23 2016 *)
-
PARI
a(n)=n%5 \\ Charles R Greathouse IV, Sep 24 2015
Formula
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).
G.f.: g(x)=(4*x^4+3*x^3+2*x^2+x)/(1-x^5). - Hieronymus Fischer, May 29 2007
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.
G.f.: also g(x) = x*(5*x^6 - 6*x^5 + 1)/((1-x^5)*(1-x)^2). - Hieronymus Fischer, Jun 01 2007
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
a(n) = floor(1234/99999*10^(n+1)) mod 10. - Hieronymus Fischer, Jan 03 2013
a(n) = floor(97/1562*5^(n+1)) mod 5. - Hieronymus Fischer, Jan 04 2013
From Wesley Ivan Hurt, Jul 23 2016: (Start)
a(n) = a(n-5) for n>4.
a(n) = 4*(1 - floor(n/5)) + Sum_{k=1..4} floor((n-k)/5).
a(n) = 4 - 4*floor(n/5) + floor((n-1)/5) + floor((n-2)/5) + floor((n-3)/5) + floor((n-4)/5).
a(n) = n - 5*floor(n/5). (End)
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
Comments