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 A153733 #60 Jul 14 2025 17:50:35 %S A153733 0,0,2,0,4,2,6,0,8,4,10,2,12,6,14,0,16,8,18,4,20,10,22,2,24,12,26,6, %T A153733 28,14,30,0,32,16,34,8,36,18,38,4,40,20,42,10,44,22,46,2,48,24,50,12, %U A153733 52,26,54,6,56,28,58,14,60,30,62,0,64,32,66,16,68,34,70,8,72,36,74,18,76,38 %N A153733 Remove all trailing 1's in the binary representation of n. %C A153733 a(n) is also the map n -> A065423(n+1) applied A007814(n+1) times. - _Federico Provvedi_, Dec 14 2021 %H A153733 Harvey P. Dale, <a href="/A153733/b153733.txt">Table of n, a(n) for n = 0..1000</a> %H A153733 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A153733 a(n) = n if n is even, a((n-1)/2) if odd. %F A153733 a(n)/2 = A025480(n). %F A153733 a(n) = A000265(n+1) - 1. - _M. F. Hasler_, Mar 16 2018 %F A153733 a(n) = n - A331739(n+1). - _Federico Provvedi_, Dec 21 2021 %p A153733 f:= n -> (n+1)/2^padic:-ordp(n+1,2)-1: %p A153733 map(f, [$0..100]); # _Robert Israel_, Mar 18 2018 %t A153733 Table[If[EvenQ[n],n,FromDigits[Flatten[Most[Split[IntegerDigits[n,2]]]],2]],{n,0,100}] (* _Harvey P. Dale_, Feb 15 2014 *) %t A153733 a[n_] := BitShiftRight[n + 1, IntegerExponent[n+1, 2]] - 1; a[Range[0,100]] (* _Federico Provvedi_, Dec 21 2021 *) %o A153733 (Haskell) %o A153733 a153733 n = if b == 0 then n else a153733 n' where (n', b) = divMod n 2 %o A153733 -- _Reinhard Zumkeller_, Jul 22 2014 %o A153733 (PARI) A153733(n)=(n+=1)>>valuation(n,2)-1 \\ most efficient variant: use this. - _M. F. Hasler_, Mar 16 2018 %o A153733 (PARI) {a(n)=while(bittest(n,0),n>>=1);n} \\ for illustration: as long as there's a trailing bit 1, remove it. - _M. F. Hasler_, Mar 16 2018 %o A153733 (PARI) a(n)=for(i=0,n,bittest(n,i)||return(n>>i)) \\ scan the trailing 1's, then remove all of them at once. - _M. F. Hasler_, Mar 16 2018 %o A153733 (Python) %o A153733 def a(n): %o A153733 while n&1: n >>= 1 %o A153733 return n %o A153733 print([a(n) for n in range(100)]) # _Michael S. Branicky_, Dec 18 2021 %o A153733 (Python) %o A153733 def A153733(n): return n>>(~(n+1)&n).bit_length() # _Chai Wah Wu_, Jul 08 2022 %Y A153733 Cf. A000265, A007814, A007088. %Y A153733 Cf. A163575. %Y A153733 Cf. A065423, A331739. %K A153733 nonn,easy %O A153733 0,3 %A A153733 _Reinhard Zumkeller_, Dec 31 2008