%I #11 Jan 18 2017 22:13:01
%S 0,4,6,40,42,44,46,112,114,116,118,120,122,124,126,1312,1314,1316,
%T 1318,1320,1322,1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,
%U 2752,2754,2756,2758,2760,2762,2764,2766,2768,2770,2772,2774,2776,2778,2780,2782,2784,2786,2788,2790
%N The decimal representation of the Elias omega code for n (A281193(n)).
%H Indranil Ghosh, <a href="/A281223/b281223.txt">Table of n, a(n) for n = 1..10000</a>
%H Khalid Sayood (Editor), <a href="https://books.google.co.in/books?id=LjQiGwyabVwC&pg=PA60&lpg=PA60&dq=bl&ots=DEU6sh5UC9&sig=GJcMAaVWdAH1pQ4LYNyZVaMUlRM&hl=en&sa=X&ved=0ahUKEwjzq7ulvcfRAhVJRo8KHbNUC1QQ6AEIITAB#v=onepage&q=Even%20Rodeh&f=false">Lossless Compression Handbook</a>, Chapter 3 - Universal Codes, p. 59, section 3.6.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Elias_omega_coding">Elias omega coding</a>
%e For n = 6, the Elias omega code for 6 is '101100' which is 44 in decimal. So, a(6) = 44.
%o (Python)
%o def E(n):
%o ....s=""
%o ....if n==1:
%o ........return "0"
%o ....else:
%o ........b=(bin(n)[2:])
%o ........s+=E(len(b)-1)+b
%o ....return s
%o def elias_omega(n):
%o ....return int(E(n)[1:]+"0",2)
%Y Cf. A281193, A171885 (Decimal representation of the Elias gamma code for n).
%K nonn,base
%O 1,2
%A _Indranil Ghosh_, Jan 18 2017
|