login
To binary representation of n, append as many ones as there are trailing zeros.
1

%I #11 Jul 08 2022 08:22:59

%S 1,5,3,19,5,13,7,71,9,21,11,51,13,29,15,271,17,37,19,83,21,45,23,199,

%T 25,53,27,115,29,61,31,1055,33,69,35,147,37,77,39,327,41,85,43,179,45,

%U 93,47,783,49,101,51,211,53,109,55,455,57,117,59,243,61,125,63,4159

%N To binary representation of n, append as many ones as there are trailing zeros.

%C a(n) = (n+1)*A006519(n)-1;

%C a(2*n-1) = 2*n-1, a(2*n) > 4*n.

%H Harvey P. Dale, <a href="/A092525/b092525.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%e n=20='10100'='101'00' -> a(20)='101'00'11'='1010011'=83.

%t bra1[n_]:=Module[{idn2=IntegerDigits[n,2]},FromDigits[Join[ idn2, Table[1,{IntegerExponent[FromDigits[idn2]]}]],2]]; Array[bra1,70] (* _Harvey P. Dale_, Sep 30 2012 *)

%o (Haskell)

%o a092525 n = f n n where

%o f x y = if m == 0 then f x' (2 * y + 1) else y

%o where (x', m) = divMod x 2

%o -- _Reinhard Zumkeller_, Oct 06 2012

%o (Python)

%o def A092525(n): return (n+1)*(~n&n-1)+n # _Chai Wah Wu_, Jul 07 2022

%Y Cf. A007814, A007088.

%K nonn

%O 1,2

%A _Reinhard Zumkeller_, Apr 07 2004