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 A063694 #55 Feb 27 2025 10:49:02 %S A063694 0,1,0,1,4,5,4,5,0,1,0,1,4,5,4,5,16,17,16,17,20,21,20,21,16,17,16,17, %T A063694 20,21,20,21,0,1,0,1,4,5,4,5,0,1,0,1,4,5,4,5,16,17,16,17,20,21,20,21, %U A063694 16,17,16,17,20,21,20,21,64,65,64,65,68,69,68,69,64,65,64,65,68,69,68 %N A063694 Remove odd-positioned bits from the binary expansion of n. %C A063694 a(n) is the formal derivative of x*n (evaluated at x=2 after being lifted to Z[x]) where n is interpreted as a polynomial in GF(2)[x] via its binary expansion. - _Keith J. Bauer_, Mar 17 2024 %C A063694 In the base 4 expansion of n, change 2 to 0 and 3 to 1. - _Paolo Xausa_, Feb 27 2025 %H A063694 Reinhard Zumkeller, <a href="/A063694/b063694.txt">Table of n, a(n) for n = 0..10000</a> %H A063694 Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a> %H A063694 Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a> %F A063694 a(n) = Sum_{k>=0} (-1)^k*2^k*floor(n/2^k). %F A063694 a(n) + A063695(n) = n. %F A063694 a(n) = n - 2*a(floor(n/2)). - _Vladeta Jovovic_, Feb 23 2003 %F A063694 G.f.: 1/(1-x) * Sum_{k>=0} (-2)^k*x^2^k/(1-x^2^k). - _Ralf Stephan_, May 05 2003 %F A063694 a(n) = 4*a(floor(n/4)) + (n mod 4) mod 2. - _Reinhard Zumkeller_, Sep 26 2015 %F A063694 a(n) = Sum_{k>=0} A030308(n,k)*A199572(k). - _Philippe Deléham_, Jan 12 2023 %e A063694 a(25) = 17 because 25 = 11001 in binary and when we AND this with 10101 we are left with 10001 = 17. %p A063694 every_other_pos := proc(nn, x, w) local n, i, s; n := nn; i := 0; s := 0; while(n > 0) do if((i mod 2) = w) then s := s + ((x^i)*(n mod x)); fi; n := floor(n/x); i := i+1; od; RETURN(s); end: [seq(every_other_pos(j, 2, 0), j=0..120)]; %t A063694 a[n_] := BitAnd[n, Sum[2^k, {k, 0, Log[2, n] // Floor, 2}]]; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Feb 28 2016 *) %t A063694 A063694[n_] := FromDigits[ReplaceAll[IntegerDigits[n, 4], {2 -> 0, 3 -> 1}], 4]; %t A063694 Array[A063694, 100, 0] (* _Paolo Xausa_, Feb 27 2025 *) %o A063694 (PARI) a(n)=sum(k=0,n,(-1)^k*2^k*floor(n/2^k)) /* since n> ceil(log(n)/log(2)) */ %o A063694 (PARI) a(n)=if(n<0,0,sum(k=0,n,(-1)^k*2^k*floor(n/2^k))) /* since n> ceil(log(n)/log(2)) */ %o A063694 (Haskell) %o A063694 a063694 0 = 0 %o A063694 a063694 n = 4 * a063694 n' + mod q 2 %o A063694 where (n', q) = divMod n 4 %o A063694 -- _Reinhard Zumkeller_, Sep 26 2015 %o A063694 (Magma) %o A063694 function A063694(n) %o A063694 if n le 1 then return n; %o A063694 else return 4*A063694(Floor(n/4)) + ((n mod 4) mod 2); %o A063694 end if; return A063694; %o A063694 end function; %o A063694 [A063694(n): n in [0..120]]; // _G. C. Greubel_, Dec 05 2022 %o A063694 (SageMath) %o A063694 def A063694(n): %o A063694 if (n<2): return n %o A063694 else: return 4*A063694(floor(n/4)) + ((n%4)%2) %o A063694 [A063694(n) for n in range(121)] # _G. C. Greubel_, Dec 05 2022 %o A063694 (Python) %o A063694 def A063694(n): return n&((1<<(m:=n.bit_length())+(m&1))-1)//3 # _Chai Wah Wu_, Jan 30 2023 %Y A063694 Cf. A004514, A063695 (remove even-positioned bits), A088442. %K A063694 nonn,base,easy %O A063694 0,5 %A A063694 _Antti Karttunen_, Aug 03 2001