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-2 of 2 results.

A261300 Concatenate successive run lengths of 0's in the binary expansion of n, each increased by 1.

Original entry on oeis.org

0, 1, 2, 11, 3, 21, 12, 111, 4, 31, 22, 211, 13, 121, 112, 1111, 5, 41, 32, 311, 23, 221, 212, 2111, 14, 131, 122, 1211, 113, 1121, 1112, 11111, 6, 51, 42, 411, 33, 321, 312, 3111, 24, 231, 222, 2211, 213, 2121, 2112, 21111, 15, 141, 132, 1311, 123, 1221, 1212, 12111, 114, 1131, 1122, 11211, 1113, 11121, 11112, 111111, 7, 61, 52
Offset: 0

Views

Author

M. F. Hasler, Aug 16 2015

Keywords

Comments

Any positive number written in binary has its first bit equal to 1. From there on we count the 0 bits up to the next 1 bit or the end of the number. Each count is increased by one because of the impossibility of representing leading 0's in this database.
The sequence is prefixed by a conventional a(0)=0, which represents an empty sum or concatenation.
The positive integer n written as a binary digit string of length m uniquely decomposes into substrings of '1' followed by a maximal run of '0's where the lengths of these substrings forms a composition of m. a(n) is the concatenation of the parts of the composition of m when written in decimal. See A066099 for the table of composition parts. - Michael Somos, Aug 20 2015
Suggested by Armands Strazds's sequence A258055.

Examples

			n=2 is written "10" in binary, so following the initial digit '1', there is one (= 1) bit zero; this 1 becomes increased to yield a(2) = 2.
n=3 is written "11" in binary, so following the initial digit '1', there is no (= 0) bit zero; after the next digit '1', there follow again 0 bits '0'. These two 0 are increased to yield two 1's, whence a(3) = 11.
		

Crossrefs

Programs

  • PARI
    A261300(n,s="",c=0)={for(i=2,#n=binary(n),c++;n[i]&&s=concat(s,c+c=0));eval(concat(s,c++))}

Formula

a(n) = Sum_{k=0..f(n)-1} T(n,k)*10^g(n,k) for n > 0 with a(0)=0 where f(n) = A000120(n), T(n,k) = T(floor(n/2),k - n mod 2) for k > 0 with T(n,0) = A001511(n), and g(n,k) = Sum_{j=0..k-1} (1 + floor(log_10(T(n,j)))). - Mikhail Kurkov, Nov 25 2019 [verification needed]

A275536 Differences of the exponents of the adjacent distinct powers of 2 in the binary representation of n (with -1 subtracted from the least exponent present) are concatenated as decimal digits in reverse order.

Original entry on oeis.org

1, 2, 11, 3, 12, 21, 111, 4, 13, 22, 112, 31, 121, 211, 1111, 5, 14, 23, 113, 32, 122, 212, 1112, 41, 131, 221, 1121, 311, 1211, 2111, 11111, 6, 15, 24, 114, 33, 123, 213, 1113, 42, 132, 222, 1122, 312, 1212, 2112, 11112
Offset: 1

Views

Author

Armands Strazds, Aug 01 2016

Keywords

Comments

A preferable representation is a sequence of arrays, since multi-digit items are possible: [1],[2],[1,1],[3],[1,2],[2,1],[1,1,1],[4],[1,3],[2,2],[1,1,2],[3,1],[1,2,1],[2,1,1],[1,1,1,1],[5],[1,4],[2,3],[1,1,3],[3,2],[1,2,2],[2,1,2],[1,1,1,2],[4,1],[1,3,1],[2,2,1],[1,1,2,1],[3,1,1],[1,2,1,1],[2,1,1,1],[1,1,1,1,1],[6],[1,5],[2,4],[1,1,4],[3,3],[1,2,3],[2,1,3],[1,1,1,3],[4,2],[1,3,2],[2,2,2],[1,1,2,2],[3,1,2],[1,2,1,2],[2,1,1,2],[1,1,1,1,2]. 0 is not allowed as a digit.
a(512) is the first term which cannot be expressed unambiguously in decimal. - Charles R Greathouse IV, Aug 02 2016
The first two terms which are equal (because of the ambiguity inherent in using decimal, or more generally any finite base) are a(3) = a(1024) = 11. a(3) corresponds to the array [1,1] while a(1024) corresponds to [11]. - Charles R Greathouse IV, Mar 19 2017

Examples

			5 = 2^2 + 2^0, so the representation is [2-0, 0-(-1)] = [2, 1] so a(5) = 12.
6 = 2^2 + 2^1, so the representation is [2-1, 1-(-1)] = [1, 2] so a(6) = 21.
18 = 2^4 + 2^1, so the representation is [4-1, 1-(-1)] = [3, 2] so a(18) = 23.
		

Crossrefs

Programs

  • PARI
    a(n)=my(v=List(),k); while(n, k=valuation(n,2)+1; n>>=k; listput(v,k)); fromdigits(Vec(v)) \\ Charles R Greathouse IV, Aug 02 2016
  • PHP
    function dec2delta($k) {
      $p = -1;
      while ($k > 0) {
        $k -= $c = pow(2, floor(log($k, 2)));
        if ($p > -1) $d[] = $p - floor(log($c, 2));
        $p = floor(log($c, 2));
      }
      $d[] = $p + 1;
      return array_reverse($d);
    }
    function delta2dec($d) {
      $k = 0;
      $e = -1;
      foreach ($d AS $v) {
        if ($v > 0) {
          $e += $v;
          $k += pow(2, $e);
        }
      }
      return $k;
    }
    

Formula

For n=1..511, a(n) = A004086(A004719(A071160(n))) [In other words, terms of A071160 with 0-digits deleted and the remaining digits reversed.] - Antti Karttunen, Sep 03 2016
Showing 1-2 of 2 results.