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 A140081 #47 Dec 12 2023 08:36:02 %S A140081 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, %T A140081 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, %U A140081 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 %N A140081 Period 4: repeat [0, 1, 1, 2]. %C A140081 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. %C A140081 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. %H A140081 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,1). %F A140081 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 %F A140081 a(n) = A047624(n+2) - A047624(n+1) - 1. - _Reinhard Zumkeller_, Feb 21 2010 %F A140081 a(n) = 1 - cos(Pi*n/2)/2 - sin(Pi*n/2)/2 - (-1)^n/2. - _R. J. Mathar_, Oct 08 2011 %F A140081 a(n) = ((n mod 4) + (n mod 2))/2. - _Gary Detlefs_, Apr 21 2012 %F A140081 From _Colin Barker_, Jan 13 2013: (Start) %F A140081 a(n) = a(n-4). %F A140081 G.f.: -x*(2*x^2+x+1) / ((x-1)*(x+1)*(x^2+1)). (End) %F A140081 a(n) = floor((3*(n mod 4) + 1)/4). - _Wesley Ivan Hurt_, Mar 27 2014 %F A140081 From _Wesley Ivan Hurt_, Apr 22 2015: (Start) %F A140081 a(n) = floor(1/2 + (n mod 4)/2). %F A140081 a(n) = 1 - (-1)^n/2 - (-1)^(n/2 - 1/4 + (-1)^n/4)/2. (End) %F A140081 a(n) = n - floor(n/2) - 2*floor(n/4). - _Ridouane Oudra_, Oct 30 2019 %p A140081 A140081:=n->floor((3*(n mod 4)+1)/4); seq(A140081(n), n=0..100); # _Wesley Ivan Hurt_, Mar 27 2014 %t A140081 PadLeft[{}, 100, {0,1,1,2}] (* _Harvey P. Dale_, Aug 19 2011 *) %t A140081 Table[Floor[(3 Mod[n, 4] + 1)/4], {n, 0, 100}] (* _Wesley Ivan Hurt_, Mar 27 2014 *) %o A140081 See link in A140080 for Fortran program. %o A140081 (PARI) a(n)=n%4-n%4\2 \\ _Jaume Oliver Lafont_, Aug 28 2009 %o A140081 (Haskell) %o A140081 a140081 n = div (mod n 4 + mod n 2) 2 %o A140081 a140081_list = cycle [0, 1, 1, 2] -- _Reinhard Zumkeller_, Aug 15 2015 %Y A140081 Cf. A140201. - _Reinhard Zumkeller_, Feb 21 2010 %K A140081 nonn,easy %O A140081 0,4 %A A140081 _Nadia Heninger_ and _N. J. A. Sloane_, Jun 03 2008