login
Simple periodic sequence: repeat 1,2,3,4.
9

%I #39 Feb 19 2024 01:51:24

%S 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,

%T 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,

%U 1,2,3,4,1,2,3,4,1,2,3,4,1

%N Simple periodic sequence: repeat 1,2,3,4.

%C Partial sums are given by A130482(n) + n + 1. - _Hieronymus Fischer_, Jun 08 2007

%C 1234/9999 = 0.123412341234... - _Eric Desbiaux_, Nov 03 2008

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

%F a(n) = 1 + (n mod 4). - _Paolo P. Lava_, Nov 21 2006

%F From _Hieronymus Fischer_, Jun 08 2007: (Start)

%F a(n) = A010873(n) + 1.

%F Also a(n) = (1/2)*(5 - (-1)^n - 2*(-1)^((2n - 1 + (-1)^n)/4))).

%F 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)

%F a(n) = 5/2 - cos(Pi*n/2) - sin(Pi*n/2) - (-1)^n/2. - _R. J. Mathar_, Oct 08 2011

%t PadRight[{},120,{1,2,3,4}] (* _Harvey P. Dale_, Aug 02 2016 *)

%o (PARI) a(n)=(n-1)%4+1 \\ _Charles R Greathouse IV_, Jun 11 2015

%o (Python)

%o def A010883(n): return 1 + (n & 3) # _Chai Wah Wu_, May 25 2022

%Y Cf. A010872, A010873, A010874, A010875, A010876, A004526, A002264, A002265, A002266.

%Y Cf. A177037 (decimal expansion of (9+2*sqrt(39))/15). - _Klaus Brockhaus_, May 01 2010

%K nonn,easy

%O 0,2

%A _N. J. A. Sloane_