cp's OEIS Frontend

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.

Showing 1-6 of 6 results.

A281225 The decimal representation of the Elias delta code for n (A281150(n)).

Original entry on oeis.org

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
Offset: 1

Views

Author

Indranil Ghosh, Jan 18 2017

Keywords

Examples

			For n = 6, The Elias delta code for 6 is "10110" which is 22 in decimal. So, a(6) = 22.
		

Crossrefs

Cf. A171885 (Decimal representation of the Elias gamma code for n), A281150, A281223.

Programs

  • 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)
    				

A281193 Elias's omega code for n.

Original entry on oeis.org

0, 100, 110, 101000, 101010, 101100, 101110, 1110000, 1110010, 1110100, 1110110, 1111000, 1111010, 1111100, 1111110, 10100100000, 10100100010, 10100100100, 10100100110, 10100101000, 10100101010, 10100101100, 10100101110, 10100110000, 10100110010, 10100110100
Offset: 1

Views

Author

Indranil Ghosh, Jan 17 2017

Keywords

Comments

The idea of the Elias omega code is similar to that of the Elias delta code (A281150), except that the length of the codeword in the omega code is recursively encoded.
The number of bits in a(n) is equal to A072464(n).

Crossrefs

Programs

  • Python
    def E(n):
        s=""
        if n==1:
            return "0"
        else:
            b=(bin(n)[2:])
            s+=E(len(b)-1)+b
        return s
    def elias_omega(n):
        return int(E(n)[1:]+"0")

A140341 The number of bits needed to write the universal code for an Elias delta coding, the simplest asymptotically optimal code.

Original entry on oeis.org

1, 4, 4, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11
Offset: 1

Views

Author

David A. Scott (biject.bwts(AT)gmail.com), May 29 2008

Keywords

Comments

A129972 is the number of bits for Elias gamma coding 1, 3, 3, 5 and A130233 is the number of bits for Fibonacci coding of integers 2, 3, 4, 4, 5, But Elias gamma and Fibonacci coding are not asymptotically optimal.

Examples

			The Elias Delta Code for 10 is '11000010', having 8 bits. So, a(10) = 8. - _Indranil Ghosh_, Jan 17 2017
		

References

  • David Salomon, Variable-length Codes for Data Compression, Springer Verlag, 2007, 191 pp.

Crossrefs

Cf. A281150 - Indranil Ghosh, Jan 17 2017

Programs

A281313 Write n in Elias's delta code, interchange the 1's and 0's and convert it back to decimal.

Original entry on oeis.org

0, 7, 6, 11, 10, 9, 8, 63, 62, 61, 60, 59, 58, 57, 56, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162
Offset: 1

Views

Author

Indranil Ghosh, Jan 19 2017

Keywords

Examples

			For n = 10, the Elias delta code for 10 is '11000010' and after interchanging the 0's and 1's it becomes '00111101'. Now, 111101_2 = 61_10. So, a(10) = 61.
		

Crossrefs

Cf. A035327, A054429 (n is converted to Elias gamma code, the 1's and 0's are interchanged and the code is converted back to decimal, for n>1), A281150.

Programs

  • Python
    def a(n):
        s=""
        for i in A281150(n):
            if i=="1":
                s+="0"
            else:
                s+="1"
        return int(s, 2)

A281380 Numbers which are palindromic in their Elias delta code representation.

Original entry on oeis.org

1, 3, 5, 11, 19, 43, 91, 123, 135, 327, 455, 551, 935, 1127, 1383, 1767, 2023, 2071, 2839, 3223, 3991, 4183, 4695, 5463, 5975, 6359, 6871, 7639, 8151, 8247, 9783, 10551, 12087, 12471, 14007, 14775, 16311, 16503, 17527, 19063, 20087, 20855, 21879, 23415, 24439, 24823, 25847, 27383
Offset: 1

Views

Author

Indranil Ghosh, Jan 21 2017

Keywords

Comments

Number n, such that A281150(n) is palindromic.

Examples

			43 is in the sequence because Elias delta code for 43 is '1101001011' and '1101001011' is palindromic.
		

Crossrefs

Programs

  • Python
    i=1
    j=1
    while j<=1012:
        if  A281150(i)==A281150(i)[::-1] :
            print(str(j)+" "+str(i))
            j+=1
        i+=1

A380934 Elias delta encoding of n converted from base 2 to integer.

Original entry on oeis.org

1, 4, 5, 12, 13, 14, 15, 32, 33, 34, 35, 36, 37, 38, 39, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219
Offset: 1

Views

Author

DarĂ­o Clavijo, Apr 21 2025

Keywords

Comments

This is the Elias delta coding of n with leading zeros omited.

Examples

			For n = 16 a(16) = 80 because:
16 = 10000_2 and
Strip leading bit of n = 0000_2.
16 is of bitsize 5.
Prepend 5-1 zeros and 5 as 101_2
0000101_2 + 0000_2 = 00001010000_2 = 80.
		

Crossrefs

Cf. A281150.

Programs

  • Mathematica
    A380934[n_] := FromDigits[Join[IntegerDigits[BitLength[n], 2], Rest[IntegerDigits[n, 2]]], 2] (* James C. McMahon, Apr 30 2025 *)
  • Python
    def a(n):
        if n == 1: return 1
        b = bin(n)[2:]
        L = len(b)
        g = '0' * (L - 1) + bin(L)[2:]
        d = g + b[1:]
        return int(d,2)
    print([a(n) for n in range(1,60)])
    
  • Python
    def A380934(n): return int(bin(n.bit_length())+bin(n)[3:],2) # Chai Wah Wu, Apr 21 2025
Showing 1-6 of 6 results.