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 A036044 #93 Dec 23 2024 02:25:42 %S A036044 1,0,2,0,6,2,4,0,14,6,10,2,12,4,8,0,30,14,22,6,26,10,18,2,28,12,20,4, %T A036044 24,8,16,0,62,30,46,14,54,22,38,6,58,26,42,10,50,18,34,2,60,28,44,12, %U A036044 52,20,36,4,56,24,40,8,48,16,32,0,126,62,94,30,110,46,78,14,118,54,86 %N A036044 BCR(n): write in binary, complement, reverse. %C A036044 a(0) could be considered to be 0 if the binary representation of zero were chosen to be the empty string. - _Jason Kimberley_, Sep 19 2011 %C A036044 From _Bernard Schott_, Jun 15 2021: (Start) %C A036044 Except for a(0) = 1, every term is even. %C A036044 For each q >= 0, there is one and only one odd number h such that a(n) = 2*q iff n = h*2^m-1 for m >= 1 when q = 0, and for m >= 0 when q >= 1 (see A345401 and some examples below). %C A036044 a(n) = 0 iff n = 2^m-1 for m >= 1 (Mersenne numbers) (A000225). %C A036044 a(n) = 2 iff n = 3*2^m-1 for m >= 0 (A153893). %C A036044 a(n) = 4 iff n = 7*2^m-1 for m >= 0 (A086224). %C A036044 a(n) = 6 iff n = 5*2^m-1 for m >= 0 (A153894). %C A036044 a(n) = 8 iff n = 15*2^m-1 for m >= 0 (A196305). %C A036044 a(n) = 10 iff n = 11*2^m-1 for m >= 0 (A086225). %C A036044 a(n) = 12 iff n = 13*2^m-1 for m >= 0 (A198274). %C A036044 For k >= 1, a(n) = 2^k iff n = (2^(k+1)-1)*2^m - 1 for m >= 0. %C A036044 Explanation for a(n) = 2: %C A036044 For m >= 0, A153893(m) = 3*2^m-1 -> 1011...11 -> 0100...00 -> 10 -> 2 where 1011...11_2 is 10 followed by m 1's. (End) %H A036044 Indranil Ghosh, <a href="/A036044/b036044.txt">Table of n, a(n) for n = 0..10000</a> (first 1024 terms from T. D. Noe) %F A036044 a(2n) = 2*A059894(n), a(2n+1) = a(2n) - 2^floor(log_2(n)+1). - _Ralf Stephan_, Aug 21 2003 %F A036044 Conjecture: a(n) = (-1)^A023416(n)*b(n) for n > 0 with a(0) = 1 where b(2^m) = (-1)^m*(2^(m+1) - 2) for m >= 0, b(2n+1) = b(n) for n > 0, b(2n) = b(n) + b(n - 2^f(n)) + b(2n - 2^f(n)) for n > 0 and where f(n) = A007814(n) (see A329369). - _Mikhail Kurkov_, Dec 13 2024 %e A036044 4 -> 100 -> 011 -> 110 -> 6. %p A036044 A036044 := proc(n) %p A036044 local bcr ; %p A036044 if n = 0 then %p A036044 return 1; %p A036044 end if; %p A036044 convert(n,base,2) ; %p A036044 bcr := [seq(1-i,i=%)] ; %p A036044 add(op(-k,bcr)*2^(k-1),k=1..nops(bcr)) ; %p A036044 end proc: %p A036044 seq(A036044(n),n=0..200) ; # _R. J. Mathar_, Nov 06 2017 %t A036044 dtn[ L_ ] := Fold[ 2#1+#2&, 0, L ]; f[ n_ ] := dtn[ Reverse[ 1-IntegerDigits[ n, 2 ] ] ]; Table[ f[ n ], {n, 0, 100} ] %t A036044 Table[FromDigits[Reverse[IntegerDigits[n,2]/.{1->0,0->1}],2],{n,0,80}] (* _Harvey P. Dale_, Mar 08 2015 *) %o A036044 (Haskell) %o A036044 import Data.List (unfoldr) %o A036044 a036044 0 = 1 %o A036044 a036044 n = foldl (\v d -> 2 * v + d) 0 (unfoldr bc n) where %o A036044 bc 0 = Nothing %o A036044 bc x = Just (1 - m, x') where (x',m) = divMod x 2 %o A036044 -- _Reinhard Zumkeller_, Sep 16 2011 %o A036044 (Magma) A036044:=func<n|n eq 0 select 1 else SequenceToInteger(Reverse([1-b:b in IntegerToSequence(n,2)]),2)>; // _Jason Kimberley_, Sep 19 2011 %o A036044 (PARI) a(n)=fromdigits(Vecrev(apply(n->1-n,binary(n))),2) \\ _Charles R Greathouse IV_, Apr 22 2015 %o A036044 (Python) %o A036044 def comp(s): z, o = ord('0'), ord('1'); return s.translate({z:o, o:z}) %o A036044 def BCR(n): return int(comp(bin(n)[2:])[::-1], 2) %o A036044 print([BCR(n) for n in range(75)]) # _Michael S. Branicky_, Jun 14 2021 %o A036044 (Python) %o A036044 def A036044(n): return -int((s:=bin(n)[-1:1:-1]),2)-1+2**len(s) # _Chai Wah Wu_, Feb 04 2022 %Y A036044 Cf. A030101, A056539, A329369, A345401. %Y A036044 Cf. A035928 (fixed points), A195063, A195064, A195065, A195066. %Y A036044 Indices of terms 0, 2, 4, 6, 8, 10, 12, 14, 18, 22, 26, 30: A000225 \ {0}, A153893, A086224, A153894, A196305, A086225, A198274, A052996\{1,3}, A291557, A198276, A171389, A198275. %K A036044 nonn,easy,base,nice,look %O A036044 0,3 %A A036044 _N. J. A. Sloane_