This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A010873 #78 Dec 30 2024 02:11:00 %S A010873 0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1, %T A010873 2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3, %U A010873 0,1,2,3,0,1,2,3,0,1,2,3,0 %N A010873 a(n) = n mod 4. %C A010873 Complement of A002265, since 4*A002265(n)+a(n) = n. - _Hieronymus Fischer_, Jun 01 2007 %C A010873 The rightmost digit in the base-4 representation of n. Also, the equivalent value of the two rightmost digits in the base-2 representation of n. - _Hieronymus Fischer_, Jun 11 2007 %C A010873 Periodic sequences of this type can be also calculated by a(n) = floor(q/(p^m-1)*p^n) mod p, where q is the number representing the periodic digit pattern and m is the period length. p and q can be calculated as follows: Let D be the array representing the number pattern to be repeated, m = size of D, max = maximum value of elements in D. Than p := max + 1 and q := p^m*sum_{i=1..m} D(i)/p^i. Example: D = (0, 1, 2, 3), p = 4 and q = 57 for this sequence. - _Hieronymus Fischer_, Jan 04 2013 %H A010873 Antti Karttunen, <a href="/A010873/b010873.txt">Table of n, a(n) for n = 0..65536</a> %H A010873 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,1). %F A010873 a(n) = (1/2)*(3-(-1)^n-2*(-1)^floor(n/2)); %F A010873 also a(n) = (1/2)*(3-(-1)^n-2*(-1)^((2*n-1+(-1)^n)/4)); %F A010873 also a(n) = (1/2)*(3-(-1)^n-2*sin(Pi/4*(2n+1+(-1)^n))). %F A010873 G.f.: (3x^3+2x^2+x)/(1-x^4). - _Hieronymus Fischer_, May 29 2007 %F A010873 From _Hieronymus Fischer_, Jun 11 2007: (Start) %F A010873 Trigonometric representation: a(n)=2^2*(sin(n*Pi/4))^2*sum{1<=k<4, k*product{1<=m<4,m<>k, (sin((n-m)*Pi/4))^2}}. Clearly, the squared terms may be replaced by their absolute values '|.|'. %F A010873 Complex representation: a(n)=1/4*(1-r^n)*sum{1<=k<4, k*product{1<=m<4,m<>k, (1-r^(n-m))}} where r=exp(Pi/2*i)=i=sqrt(-1). All these formulas can be easily adapted to represent any periodic sequence. %F A010873 a(n) = n mod 2+2*(floor(n/2)mod 2) = A000035(n)+2*A000035(A004526(n)). (End) %F A010873 a(n) = 6 - a(n-1) - a(n-2) - a(n-3) for n > 2. - _Reinhard Zumkeller_, Apr 13 2008 %F A010873 a(n) = 3/2 + cos((n+1)*Pi)/2 + sqrt(2)*cos((2*n+3)*Pi/4). - _Jaume Oliver Lafont_, Dec 05 2008 %F A010873 From _Hieronymus Fischer_, Jan 04 2013: (Start) %F A010873 a(n) = floor(41/3333*10^(n+1)) mod 10. %F A010873 a(n) = floor(19/85*4^(n+1)) mod 4. (End) %F A010873 E.g.f.: 2*sinh(x) - sin(x) + cosh(x) - cos(x). - _Stefano Spezia_, Apr 20 2021 %F A010873 From _Nicolas Bělohoubek_, May 30 2024: (Start) %F A010873 a(n) = (2*a(n-1)-1)*(2-a(n-2)) for n > 1. %F A010873 a(n) = (2*a(n-1)^2+1)*(3-a(n-1))/3 for n > 0. (End) %p A010873 seq(chrem( [n,n], [1,4] ), n=0..80); # _Zerinvary Lajos_, Mar 25 2009 %t A010873 nn=40; CoefficientList[Series[(x+2x^2+3x^3)/(1-x^4), {x,0,nn}], x] (* _Geoffrey Critzer_, Jul 26 2013 *) %t A010873 Table[Mod[n,4], {n, 0, 100}] (* _T. D. Noe_, Jul 26 2013 *) %t A010873 PadRight[{},120,{0,1,2,3}] (* _Harvey P. Dale_, Mar 29 2018 *) %o A010873 (PARI) a(n)=n%4 \\ _Charles R Greathouse IV_, Dec 05 2011 %o A010873 (Haskell) %o A010873 a010873 n = (`mod` 4) %o A010873 a010873_list = cycle [0..3] -- _Reinhard Zumkeller_, Jun 05 2012 %o A010873 (Scheme) (define (A010873 n) (modulo n 4)) ;; _Antti Karttunen_, Nov 07 2017 %Y A010873 Partial sums: A130482. Other related sequences A130481, A130483, A130484, A130485. %Y A010873 Cf. A004526, A002264, A002265, A002266. %Y A010873 Cf. A000035, A010877. %K A010873 nonn,easy %O A010873 0,3 %A A010873 _N. J. A. Sloane_ %E A010873 First to third formulas re-edited for better readability by _Hieronymus Fischer_, Dec 05 2011 %E A010873 Incorrect g.f. removed by _Georg Fischer_, May 18 2019