A010883 Simple periodic sequence: repeat 1,2,3,4.
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,1).
Crossrefs
Programs
-
Mathematica
PadRight[{},120,{1,2,3,4}] (* Harvey P. Dale, Aug 02 2016 *)
-
PARI
a(n)=(n-1)%4+1 \\ Charles R Greathouse IV, Jun 11 2015
-
Python
def A010883(n): return 1 + (n & 3) # Chai Wah Wu, May 25 2022
Formula
a(n) = 1 + (n mod 4). - Paolo P. Lava, Nov 21 2006
From Hieronymus Fischer, Jun 08 2007: (Start)
a(n) = A010873(n) + 1.
Also a(n) = (1/2)*(5 - (-1)^n - 2*(-1)^((2*n - 1 + (-1)^n)/4)).
G.f.: g(x) = (4*x^3 + 3*x^2 + 2*x + 1)/(1 - x^4) = (4*x^5 - 5*x^4 + 1)/((1 - x^4)*(1-x)^2). (End)
a(n) = 5/2 - cos(Pi*n/2) - sin(Pi*n/2) - (-1)^n/2. - R. J. Mathar, Oct 08 2011
Comments