login
This site is supported by donations to The OEIS Foundation.

 

Logo

"Email this user" was broken Aug 14 to 9am Aug 16. If you sent someone a message in this period, please send it again.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A010873 a(n) = n mod 4. 57
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, 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, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

Complement of A002265, since 4*A002265(n)+a(n) = n. - Hieronymus Fischer, Jun 01 2007

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

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

LINKS

Table of n, a(n) for n=0..80.

Index entries for linear recurrences with constant coefficients, signature (0,0,0,1).

FORMULA

a(n) = (1/2)*(3-(-1)^n-2*(-1)^floor(n/2));

also a(n) = (1/2)*(3-(-1)^n-2*(-1)^((2n-1+(-1)^n)/4)));

also a(n) = (1/2)*(3-(-1)^n-2*sin(Pi/4*(2n+1+(-1)^n))).

G.f.: (3x^3+2x^2+x)/(1-x^4). - Hieronymus Fischer, May 29 2007

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 '|.|'.

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.

G.f.: x(4x^5-5x^4+1)/((1-x^4)(1-x)^2). - Hieronymus Fischer, Jun 01 2007

a(n) = n mod 2+2*(floor(n/2)mod 2) = A000035(n)+2*A000035(A004526(n)). - Hieronymus Fischer, Jun 11 2007

a(n) = 6 - a(n-1) - a(n-2) - a(n-3) for n > 2. - Reinhard Zumkeller, Apr 13 2008

a(n) = 3/2 + cos((n+1)pi)/2 + sqrt(2)cos((2n+3)Pi/4) [Jaume Oliver Lafont, Dec 05 2008]

a(n) = floor(41/3333*10^(n+1)) mod 10. - Hieronymus Fischer, Jan 04 2013

a(n) = floor(19/85*4^(n+1)) mod 4. - Hieronymus Fischer, Jan 04 2013

MAPLE

seq(chrem( [n, n], [1, 4] ), n=0..80); # Zerinvary Lajos, Mar 25 2009

MATHEMATICA

nn=40; CoefficientList[Series[(x+2x^2+3x^3)/(1-x^4), {x, 0, nn}], x] (* Geoffrey Critzer, Jul 26 2013 *)

Table[Mod[n, 4], {n, 0, 100}] (* T. D. Noe, Jul 26 2013 *)

PROG

(PARI) a(n)=n%4 \\ Charles R Greathouse IV, Dec 05 2011

(Haskell)

a010873 n = (`mod` 4)

a010873_list = cycle [0..3]  -- Reinhard Zumkeller, Jun 05 2012

CROSSREFS

Partial sums: A130482. Other related sequences A130481, A130483, A130484, A130485.

Cf. A004526, A002264, A002265, A002266.

Sequence in context: A106728 A276335 A189480 * A049804 A277904 A132387

Adjacent sequences:  A010870 A010871 A010872 * A010874 A010875 A010876

KEYWORD

nonn,easy

AUTHOR

N. J. A. Sloane.

EXTENSIONS

First to third formulas re-edited for better readability by Hieronymus Fischer, Dec 05 2011

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified August 17 15:19 EDT 2017. Contains 290635 sequences.