login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A281225 The decimal representation of the Elias delta code for n (A281150(n)). 2
1, 8, 9, 20, 21, 22, 23, 192, 193, 194, 195, 196, 197, 198, 199, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
J. Nelson Raja, P. Jaganathan and S. Domnic, A New Variable-Length Integer Code for Integer Representation and Its Application to Text Compression, Indian Journal of Science and Technology, Vol 8(24), September 2015.
EXAMPLE
For n = 6, The Elias delta code for 6 is "10110" which is 22 in decimal. So, a(6) = 22.
PROG
(Python)
def unary(n):
....return "1"*(n-1)+"0"
def elias_gamma(n):
....if n==1:
........return "1"
....k=int(math.log(n, 2))
....fp=unary(1+k) #fp is the first part
....sp=n-2**(k) #sp is the second part
....nb=k #nb is the number of bits used to store sp in binary
....sp=bin(sp)[2:]
....if len(sp)<nb:
........sp=("0"*(nb-len(sp)))+sp
....return fp+sp
def elias_delta(n):
....if n==1:
........return "1"
....k=int(math.log(n, 2))
....fp=elias_gamma(1+k)#fp is the first part
....sp=n-2**(k) #sp is the second part
....nb=k #nb is the number of bits used to store sp in binary
....sp=bin(sp)[2:]
....if len(sp)<nb:
........sp=("0"*(nb-len(sp)))+sp
....return fp+sp
def a(n):
....return int(elias_delta(n), 2)
CROSSREFS
Cf. A171885 (Decimal representation of the Elias gamma code for n), A281150, A281223.
Sequence in context: A120311 A061414 A240915 * A071869 A326444 A309484
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Jan 18 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 03:03 EDT 2024. Contains 371917 sequences. (Running on oeis4.)