The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”).

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A140081 Period 4: repeat [0, 1, 1, 2]. 7
 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,4 COMMENTS Also fix e = 4; then a(n) = minimal Hamming distance between the binary representation of n and the binary representation of any multiple k*e (0 <= k <= n/e) which is a child of n. A number m is a child of n if the binary representation of n has a 1 in every position where the binary representation of m has a 1. LINKS Index entries for linear recurrences with constant coefficients, signature (0,0,0,1). FORMULA a(n) = (1/12)*(8*(n mod 4)-((n+1) mod 4) + 2*((n+2) mod 4) - ((n+3) mod 4)), with n >= 0. - Paolo P. Lava, Jun 06 2008 a(n) = 1 - (1/4)*(1-i)*i^n - (1/2)*(-1)^n - (1/4)*(1+i)*(-i)^n, where i=sqrt(-1), for n >= 0. - Paolo P. Lava, Jul 17 2008 a(n) = 1 + a(n - 1 - a(n-1)) + 2*a(a(n-1)) - 2*a(n-1), a(0)=0. - Ramasamy Chandramouli, Jan 31 2010 a(n) = A047624(n+2) - A047624(n+1) - 1. - Reinhard Zumkeller, Feb 21 2010 a(n) = 1 - cos(Pi*n/2)/2 - sin(Pi*n/2)/2 - (-1)^n/2. - R. J. Mathar, Oct 08 2011 a(n) = ((n mod 4) + (n mod 2))/2. - Gary Detlefs, Apr 21 2012 From Colin Barker, Jan 13 2013: (Start) a(n) = a(n-4). G.f.: -x*(2*x^2+x+1) / ((x-1)*(x+1)*(x^2+1)). (End) a(n) = floor((3*(n mod 4) + 1)/4). - Wesley Ivan Hurt, Mar 27 2014 From Wesley Ivan Hurt, Apr 22 2015: (Start) a(n) = floor(1/2 + (n mod 4)/2). a(n) = 1 - (-1)^n/2 - (-1)^(n/2 - 1/4 + (-1)^n/4)/2. (End) a(n) = n - floor(n/2) - 2*floor(n/4). - Ridouane Oudra, Oct 30 2019 MAPLE A140081:=n->floor((3*(n mod 4)+1)/4); seq(A140081(n), n=0..100); # Wesley Ivan Hurt, Mar 27 2014 MATHEMATICA PadLeft[{}, 100, {0, 1, 1, 2}] (* Harvey P. Dale, Aug 19 2011 *) Table[Floor[(3 Mod[n, 4] + 1)/4], {n, 0, 100}] (* Wesley Ivan Hurt, Mar 27 2014 *) PROG See link in A140080 for Fortran program. (PARI) a(n)=n%4-n%4\2 \\ Jaume Oliver Lafont, Aug 28 2009 (Haskell) a140081 n = div (mod n 4 + mod n 2) 2 a140081_list = cycle [0, 1, 1, 2]  -- Reinhard Zumkeller, Aug 15 2015 CROSSREFS Cf. A140201. - Reinhard Zumkeller, Feb 21 2010 Sequence in context: A276771 A062984 A105243 * A280596 A112345 A336469 Adjacent sequences:  A140078 A140079 A140080 * A140082 A140083 A140084 KEYWORD nonn,easy AUTHOR Nadia Heninger and N. J. A. Sloane, Jun 03 2008 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
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified December 1 16:28 EST 2021. Contains 349430 sequences. (Running on oeis4.)