%I #14 Jul 16 2022 17:15:45
%S 2,2,10,4,10,10,42,8,18,10,42,20,42,42,170,16,34,18,74,20,42,42,170,
%T 40,82,42,170,84,170,170,682,32,66,34,138,36,74,74,298,40,82,42,170,
%U 84,170,170,682,80,162,82,330,84,170,170,682,168,338,170,682,340,682,682,2730
%N Write n in binary. Place a 0 right of every 1 without a 0 right of it. a(n) = the decimal value of the result.
%C All terms are even.
%H Vincenzo Librandi, <a href="/A163808/b163808.txt">Table of n, a(n) for n = 1..1000</a>
%e 13 in binary is 1101. The first and last 1 each do not have a 0 right of them. So place a 0 after the first 1 and after the last 1 so as to get 101010. a(13) is the decimal equivalent of 101010, which is 42.
%t f[n_Integer]:=Module[{l=IntegerDigits[n,2]//.{a___,1,1,b___}->{a,1,0,1,b}},If[Last[l]==1,l=Append[l,0],l]; FromDigits[l,2]]; Table[f[i], {i, 60}] (* _Harvey P. Dale_, Aug 13 2009 *)
%Y Cf. A163809.
%K base,nonn
%O 1,1
%A _Leroy Quet_, Aug 04 2009
%E Additional terms provided. _Harvey P. Dale_, Aug 12 2009
%E More terms from _Sean A. Irvine_, Nov 05 2009
|