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

A071162 Simple rewriting of binary expansion of n resulting A014486-codes for rooted binary trees with height equal to number of internal vertices. (Binary trees where at each internal vertex at least the other child is leaf).

Original entry on oeis.org

0, 2, 10, 12, 42, 44, 52, 56, 170, 172, 180, 184, 212, 216, 232, 240, 682, 684, 692, 696, 724, 728, 744, 752, 852, 856, 872, 880, 936, 944, 976, 992, 2730, 2732, 2740, 2744, 2772, 2776, 2792, 2800, 2900, 2904, 2920, 2928, 2984, 2992, 3024, 3040, 3412, 3416
Offset: 0

Views

Author

Antti Karttunen, May 14 2002

Keywords

Comments

Essentially rewrites in binary expansion of n each 0 -> 01, 1X -> 1(rewrite X)0, where X is the maximal suffix after the 1-bit, which will be rewritten recursively (see the given Scheme-function). Because of this, the terms of the binary length 2n are counted by 2's powers, A000079.
In rooted plane (general) tree context, these are those totally balanced binary sequences (terms of A014486) where non-leaf subtrees can occur only as the rightmost branch (at any level of a general tree), but nowhere else. (Cf. A209642).
Also, these are exactly those rooted plane trees whose Łukasiewicz words happen to be valid asynchronous siteswap juggling patterns. (This was the original, albeit quite frivolous definition of this sequence for almost ten years 2002-2012. Cf. A071160.)

Crossrefs

a(n) = A014486(A071163(n)) = A036044(A209642(n)) = A056539(A209642(n)).
A209859 provides an "inverse" function, i.e. A209859(a(n)) = n for all n.

Programs

  • Python
    def a036044(n): return int(''.join('1' if i == '0' else '0' for i in bin(n)[2:][::-1]), 2)
    def a209642(n):
        s=0
        i=1
        while n!=0:
            if n%2==0:
                n//=2
                s=4*s + 1
            else:
                n=(n - 1)//2
                s=(s + i)*2
            i*=4
        return s
    def a(n): return 0 if n==0 else a036044(a209642(n))
    print([a(n) for n in range(101)]) # Indranil Ghosh, May 25 2017
  • Scheme
    (define (A071162 n) (let loop ((n n) (s 0) (i 1)) (cond ((zero? n) s) ((even? n) (loop (/ n 2) (+ s i) (* i 4))) (else (loop (/ (- n 1) 2) (* 2 (+ s i)) (* i 4))))))
    

A071161 Integers whose decimal expansion satisfies the condition that if we read each term from the left to right (the most significant to the least significant digit) then each nonzero digit gives a distance to the next nonzero digit to right (with a cyclic wrap-over from the least-significant to the most significant nonzero digit).

Original entry on oeis.org

0, 1, 11, 20, 111, 120, 201, 300, 1111, 1120, 1201, 1300, 2011, 2020, 3001, 4000, 11111, 11120, 11201, 11300, 12011, 12020, 13001, 14000, 20111, 20120, 20201, 20300, 30011, 30020, 40001, 50000, 111111, 111120, 111201, 111300, 112011
Offset: 0

Views

Author

Antti Karttunen, May 14 2002

Keywords

Crossrefs

Subset of A071154. The initial portion (up to the 511th term) of this sequence satisfies A071161(n) = A071160(A054429(n)).

A209644 Łukasiewicz words (without the last zero) for rooted plane trees where non-leaf branching can occur only at the leftmost branch of any level, but nowhere else.

Original entry on oeis.org

0, 1, 20, 11, 300, 210, 120, 111, 4000, 3100, 2200, 1300, 2110, 1210, 1120, 1111, 50000, 41000, 32000, 23000, 14000, 31100, 22100, 13100, 21200, 12200, 11300, 21110, 12110, 11210, 11120, 11111, 600000, 510000, 420000, 330000, 240000, 150000, 411000, 321000, 231000, 141000, 312000, 222000, 132000, 213000
Offset: 0

Views

Author

Antti Karttunen, Mar 24 2012

Keywords

Comments

Note: this finite decimal representation works only up to the 511th term, as the 512th such word is already (10,0,0,0,0,0,0,0,0,0).

Crossrefs

A209643 gives the positions of these terms in A071153 (A014486).
Cf. A071160.

Formula

a(n) = A071153(A209643(n)).

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