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-10 of 32 results. Next

A130369 Signature permutation of a Catalan automorphism: apply *A074679 to the root and recurse down the cdr-spine (the right-hand side edge of a binary tree) as long as the binary tree rotation is possible and if the top-level length (A057515(n)) is odd, then apply *A069770 to the last branch-point.

Original entry on oeis.org

0, 1, 3, 2, 6, 7, 8, 4, 5, 15, 14, 16, 17, 18, 19, 20, 21, 9, 10, 22, 11, 12, 13, 39, 40, 41, 37, 38, 43, 42, 44, 45, 46, 47, 48, 49, 50, 52, 51, 53, 54, 55, 56, 57, 58, 23, 24, 59, 25, 26, 27, 60, 61, 62, 28, 29, 63, 30, 31, 32, 64, 33, 34, 35, 36, 113, 112, 114, 115, 116
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Comments

This automorphism converts lists of even length (1 2 3 4 ... 2n-1 2n) to the form ((1 . 2) (3 . 4) ... (2n-1 . 2n)) and when applied to lists of odd length, like (1 2 3 4 5), i.e. (1 . (2 . (3 . (4 . (5 . ()))))), converts them as ((1 . 2) . ((3 . 4) . (() . 5))).

Crossrefs

Inverse: A130370. a(n) = A074685(A130372(n)) = A130376(A074685(n)). The number of cycles, number of fixed points, maximum cycle sizes and LCM's of all cycle sizes in range [A014137(n-1)..A014138(n-1)] of this permutation are given by A130377, LEFT(A019590), A130378 and A130379.

A057518 The global ranks of each term of A057517, i.e., tells that A057515(A057518(n)) = 2 for all n.

Original entry on oeis.org

2, 5, 6, 12, 13, 15, 16, 19, 31, 32, 34, 35, 36, 40, 41, 43, 44, 47, 52, 53, 56, 60, 87, 88, 90, 91, 92, 96, 97, 99, 100, 101, 103, 104, 105, 106, 115, 116, 118, 119, 120, 124, 125, 127, 128, 131, 136, 137, 140, 144, 152, 153, 155, 156, 159, 164, 165, 168, 172, 178
Offset: 1

Views

Author

Antti Karttunen, Sep 03 2000

Keywords

Crossrefs

Programs

  • Maple
    map(CatalanRankGlobal, A057517); # CatalanRankGlobal given in A057117.

A130339 Signature permutation of a Catalan automorphism: swap the two rightmost subtrees of general trees, if the root degree (A057515(n)) is even.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 11, 16, 19, 14, 15, 12, 17, 18, 13, 20, 21, 22, 23, 25, 24, 26, 27, 28, 29, 30, 44, 47, 33, 53, 56, 60, 37, 38, 39, 43, 52, 42, 40, 31, 45, 46, 32, 48, 49, 50, 51, 41, 34, 54, 55, 35, 57, 58, 59, 36, 61, 62, 63, 64, 65, 66, 67, 72, 75, 70, 71
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Comments

This self-inverse automorphism is obtained as either SPINE(*A129608) or ENIPS(*A129608). See the definitions given in A122203 and A122204.

Crossrefs

Cf. a(n) = A057508(A130340(A057508(n))) = A057164(A130340(A057164(n))). Row 3608 of A122285 and A122286. a(n) = A129608(n), if A057515(n) mod 2 = 0, otherwise a(n)=n.

A130371 Signature permutation of a Catalan automorphism: apply *A074685 to the last subtree, if the root degree (A057515(n)) is odd.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14, 15, 16, 20, 21, 19, 22, 18, 17, 23, 24, 25, 27, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 55, 54, 47, 57, 58, 59, 51, 52, 53, 61, 62, 56, 63, 48, 49, 60, 64, 50, 46, 45, 65, 66, 67, 68, 69, 70, 71
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Crossrefs

Inverse: A130372. a(n) = A130370(A074685(n)) = A074686(A130375(A074685(n))) = A130370(A130375(A130369(n))).

A130372 Signature permutation of a Catalan automorphism: apply *A074686 to the last subtree, if the root degree (A057515(n)) is odd.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14, 15, 16, 22, 21, 19, 17, 18, 20, 23, 24, 25, 27, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 64, 63, 47, 58, 59, 62, 51, 52, 53, 46, 45, 56, 48, 49, 50, 60, 54, 55, 57, 61, 65, 66, 67, 68, 69, 70, 71
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Crossrefs

Inverse: A130371. a(n) = A074686(A130369(n)) = A074686(A130376(A074685(n))) = A130370(A130376(A130369(n))).

A130340 Signature permutation of a Catalan automorphism: swap the two leftmost subtrees of general trees, if the root degree (A057515(n)) is even.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 11, 16, 19, 14, 15, 12, 17, 18, 13, 20, 21, 22, 23, 24, 25, 26, 27, 37, 29, 30, 44, 47, 33, 53, 56, 60, 28, 38, 39, 43, 52, 42, 40, 31, 45, 46, 32, 48, 49, 50, 51, 41, 34, 54, 55, 35, 57, 58, 59, 36, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Comments

This is a self-inverse automorfism (an involution). Can be used to construct A130373.

Crossrefs

Cf. a(n) = A057508(A130339(A057508(n))) = A057164(A130339(A057164(n))). a(n) = A072796(n), if A057515(n) mod 2 = 0, otherwise a(n)=n.

A130373 Signature permutation of a Catalan automorphism: flip the positions of even- and odd-indexed elements at the top level of the list, leaving the first element in place if the length (A057515(n)) is odd.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 5, 7, 8, 9, 11, 10, 16, 19, 14, 15, 12, 17, 18, 13, 20, 21, 22, 23, 25, 24, 30, 33, 37, 29, 26, 44, 47, 27, 53, 56, 60, 28, 39, 38, 43, 52, 42, 40, 31, 45, 46, 32, 48, 49, 50, 51, 41, 34, 54, 55, 35, 57, 58, 59, 36, 61, 62, 63, 64, 65, 67, 66, 72, 75, 79, 71
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Comments

This self-inverse automorphism permutes the top level of a list of even length (1 2 3 4 ... 2n-1 2n) as (2 1 4 3 ... 2n 2n-1), and when applied to a list of odd length (1 2 3 4 5 ... 2n 2n+1), permutes it as (1 3 2 5 4 ... 2n+1 2n).

Crossrefs

SPINE and ENIPS transform of *A130340 (transformations explained in A122203 and A122204).
The number of cycles and the number of fixed points in range [A014137(n-1)..A014138(n-1)] of this permutation are given by A073193 and A073192.

Formula

A130374 Signature permutation of a Catalan automorphism: flip the positions of even- and odd-indexed elements at the top level of the list, leaving the last element in place if the length (A057515(n)) is odd.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 14, 16, 19, 11, 15, 12, 17, 18, 13, 20, 21, 22, 23, 25, 24, 26, 27, 37, 38, 42, 44, 47, 51, 53, 56, 60, 28, 29, 39, 43, 52, 30, 40, 31, 45, 46, 32, 48, 49, 50, 33, 41, 34, 54, 55, 35, 57, 58, 59, 36, 61, 62, 63, 64, 65, 66, 70, 72, 75, 67, 71
Offset: 0

Views

Author

Antti Karttunen, Jun 05 2007

Keywords

Comments

This self-inverse automorphism permutes the top level of a list of even length (1 2 3 4 ... 2n-1 2n) as (2 1 4 3 ... 2n 2n-1), and when applied to a list of odd length (1 2 3 4 ... 2n-1 2n 2n+1), permutes it as (2 1 4 3 ... 2n 2n-1 2n+1).

Crossrefs

Cf. a(n) = A057508(A130373(A057508(n))) = A057164(A130373(A057164(n))) = A127285(A127288(n)) = A127287(A127286(n)). Also a(A085223(n)) = A130370(A122282(A130369(A085223(n)))) holds for all n>=0. The number of cycles and the number of fixed points in range [A014137(n-1)..A014138(n-1)] of this permutation are given by A073193 and A073192.

A014486 List of totally balanced sequences of 2n binary digits written in base 10. Binary expansion of each term contains n 0's and n 1's and reading from left to right (the most significant to the least significant bit), the number of 0's never exceeds the number of 1's.

Original entry on oeis.org

0, 2, 10, 12, 42, 44, 50, 52, 56, 170, 172, 178, 180, 184, 202, 204, 210, 212, 216, 226, 228, 232, 240, 682, 684, 690, 692, 696, 714, 716, 722, 724, 728, 738, 740, 744, 752, 810, 812, 818, 820, 824, 842, 844, 850, 852, 856, 866, 868, 872, 880, 906, 908, 914
Offset: 0

Views

Author

Keywords

Comments

The binary Dyck-Language (A063171) in decimal representation.
These encode width 2n mountain ranges, rooted planar trees of n+1 vertices and n edges, planar planted trees with n nodes, rooted plane binary trees with n+1 leaves (2n edges, 2n+1 vertices, n internal nodes, the root included), Dyck words, binary bracketings, parenthesizations, non-crossing handshakes and partitions and many other combinatorial structures in Catalan family, enumerated by A000108.
Is Sum_{k=1..n} a(k) / n^(5/2) bounded? - Benoit Cloitre, Aug 18 2002
This list is the intersection of A061854 and A031443. - Jason Kimberley, Jan 18 2013
The sequence does start at n = 0, since in the binary interpretation of the Dyck language (e.g., as parenthesizations where "1" stands for "(" and "0" stands for ")") having a(0) = 0 will do since it would stand for the empty string where the "0"s and "1"s are balanced (hence the parentheses are balanced). - Daniel Forgues, Feb 17 2013
It appears that for n>=1 this sequence can be obtained by concatenating the terms of the irregular array whose n-th row length is A000108(n) and that is defined recursively by B(n,0) = A020988(n) and B(n,k) = B(n, k-1) + D(n, k-1) where D(x,y) = (2^(2*(A089309(B(x,y))-1))-1)*(2/3) + 2^A007814(B(x,y)). - Raúl Mario Torres Silva and Michel Marcus, May 01 2020
This encoding is related to the ranking by standard ordered tree numbers in that (1) the binary encoding of trees ordered by standard ranking is given by A358505, while (2) the standard ranking of trees ordered by binary encoding is given by A358523. - Gus Wiseman, Nov 21 2022

Examples

			a(19) = 226_10 = 11100010_2 = A063171(19) as bracket expression: ( ( ( ) ) )( ) and as a binary tree, proceeding from left to right in depth-first fashion, with 1's in binary expansion standing for internal (branching) nodes and 0's for leaves:
  0   0
   \ /
    1   0 0  (0)
     \ /   \ /
      1     1
       \   /
         1
Note that in this coding scheme the last leaf of the binary trees (here in parentheses) is implicit. This tree can be also converted to a particular S-expression in languages like Lisp, Scheme and Prolog, if we interpret its internal nodes (1's) as cons cells with each leftward leaning branch being the "car" and the rightward leaning branch the "cdr" part of the pair, with the terminal nodes (0's) being ()'s (NILs). Thus we have (cons (cons (cons () ()) ()) (cons () ())) = '( ( ( () . () ) . () ) . ( () . () ) ) = (((())) ()) i.e., the same bracket expression as above, but surrounded by extra parentheses. This mapping is performed by the Scheme function A014486->parenthesization given below.
From _Gus Wiseman_, Nov 21 2022: (Start)
The terms and corresponding ordered rooted trees begin:
    0: o
    2: (o)
   10: (oo)
   12: ((o))
   42: (ooo)
   44: (o(o))
   50: ((o)o)
   52: ((oo))
   56: (((o)))
  170: (oooo)
  172: (oo(o))
  178: (o(o)o)
  180: (o(oo))
  184: (o((o)))
(End)
		

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4A: Combinatorial Algorithms, Part 1, Addison-Wesley, 2011, Section 7.2.1.6, pp. 443 (Algorithm P).

Crossrefs

Characteristic function: A080116. Inverse function: A080300.
The terms of binary width 2n are counted by A000108(n). Subset of A036990. Number of peaks in each mountain (number of leaves in rooted plane general trees): A057514. Number of trailing zeros in the binary expansion: A080237. First differences: A085192.
Branches of the ordered tree are counted by A057515.
Edges of the ordered tree are counted by A072643.
The Matula-Goebel number of the ordered tree is A127301.
The standard ranking of the ordered tree is A358523.
The depth of the ordered tree is A358550.
Nodes of the ordered tree are counted by A358551.

Programs

  • Maple
    # Maple procedure CatalanUnrank is adapted from the algorithm 3.24 of the CAGES book and the Scheme function CatalanUnrank from Ruskey's thesis. See the a089408.c program for the corresponding C procedures.
    CatalanSequences := proc(upto_n) local n,a,r; a := []; for n from 0 to upto_n do for r from 0 to (binomial(2*n,n)/(n+1))-1 do a := [op(a),CatalanUnrank(n,r)]; od; od; return a; end;
    CatalanUnrank := proc(n,rr) local r,x,y,lo,m,a; r := (binomial(2*n,n)/(n+1))-(rr+1); y := 0; lo := 0; a := 0; for x from 1 to 2*n do m := Mn(n,x,y+1); if(r <= lo+m-1) then y := y+1; a := 2*a + 1; else lo := lo+m; y := y-1; a := 2*a; fi; od; return a; end;
    Mn := (n,x,y) -> binomial(2*n-x,n-((x+y)/2)) - binomial(2*n-x,n-1-((x+y)/2));
    # Alternative:
    bin := n -> ListTools:-Reverse(convert(n, base, 2)):
    isA014486 := proc(n): local B, s, b; s := 0;
        if n > 0 then
          for b in bin(n) do
              s := s + ifelse(b = 1, 1, -1);
               if 0 > s then return false fi;
          od fi;
      s = 0 end:
    select(isA014486, [seq(0..240)]);  # Peter Luschny, Mar 13 2024
  • Mathematica
    cat[ n_ ] := (2 n)!/n!/(n+1)!; b2d[li_List] := Fold[2#1+#2&, 0, li]
    d2b[n_Integer] := IntegerDigits[n, 2]
    tree[n_] := Join[Table[1, {i, 1, n}], Table[0, {i, 1, n}]]
    nexttree[t_] := Flatten[Reverse[t]/. {a___, 0, 0, 1, b___}:> Reverse[{Sort[{a, 0}]//Reverse, 1, 0, b}]]
    wood[ n_ /; n<8 ] := NestList[ nexttree, tree[ n ], cat[ n ]-1 ]
    Table[ Reverse[ b2d/@wood[ j ] ], {j, 0, 6} ]//Flatten
    (* Alternative code *)
    tbQ[n_]:=Module[{idn2=IntegerDigits[n,2]},Count[idn2,1]==Length[idn2]/2&&Min[Accumulate[idn2/.{0->-1}]]>=0]; Join[{0},Select[Range[900],tbQ]] (* Harvey P. Dale, Jul 04 2013 *)
    balancedQ[0] = True; balancedQ[n_] := Module[{s = 0}, Do[s += If[b == 1, 1, -1]; If[s < 0, Return[False]], {b, IntegerDigits[n, 2]}]; Return[s == 0] ]; A014486 = FromDigits /@ IntegerDigits[Select[Range[0, 1000], balancedQ ]] (* Jean-François Alcover, Mar 05 2016 *)
    A014486Q[0] = True; A014486Q[n_] := Catch[Fold[If[# < 0, Throw[False], If[#2 == 0, # - 1, # + 1]] &, 0, IntegerDigits[n, 2]] == 0]; Select[Range[0, 880], A014486Q] (* JungHwan Min, Dec 11 2016 *)
    (* Uses Algorithm P from Knuth's TAOCP section 7.2.1.6 - see References and Links. *)
    alist[n_] := Block[{a = Flatten[Table[{1, 0}, n]], m = 2*n - 1, j, k},
        FromDigits[#, 2]& /@ Reap[
        While[True,
            Sow[a]; a[[m]] = 0;
            If[a[[m - 1]] == 0,
                a[[--m]] = 1, j = m - 1; k = 2*n - 1;
                While[j > 1 && a[[j]] == 1, a[[j--]] = 0; a[[k]] = 1; k -= 2];
                If[j == 1, Break[]];
                a[[j]] = 1; m = 2*n - 1]
        ]][[2, 1]]];
    Join[{{0}, {2}}, Array[alist, 4, 2]] (* Paolo Xausa, Mar 16 2024 *)
  • PARI
    isA014486(n)=my(v=binary(n),t=0);for(i=1,#v,t+=if(v[i],1,-1);if(t<0,return(0))); t==0 \\ Charles R Greathouse IV, Jun 10 2011
    
  • PARI
    a_rows(N) = my(a=Vec([[0]], N)); for(r=1, N-1, my(b=a[r], c=List()); foreach(b, t, my(v=if(t, valuation(t, 2), 0)); for(i=0, v, listput(~c, (t<<2)+(2<Ruud H.G. van Tol, May 16 2024
    
  • Python
    from itertools import count, islice
    from sympy.utilities.iterables import multiset_permutations
    def A014486_gen(): # generator of terms
        yield 0
        for l in count(1):
            for s in multiset_permutations('0'*l+'1'*(l-1)):
                c, m = 0, (l<<1)-1
                for i in range(m):
                    if s[i] == '1':
                        c += 2
                    if cA014486_list = list(islice(A014486_gen(),30)) # Chai Wah Wu, Nov 28 2023
  • SageMath
    def is_A014486(n) :
        B = bin(n)[2::] if n != 0 else 0
        s = 0
        for b in B :
            s += 1 if b=='1' else -1
            if 0 > s : return False
        return 0 == s
    def A014486_list(n): return [k for k in (1..n) if is_A014486(k) ]
    A014486_list(888) # Peter Luschny, Aug 10 2012
    

Extensions

Additional comments from Antti Karttunen, Aug 11 2000 and May 25 2004
Added a(0)=0 (which had been removed in June 2011), Joerg Arndt, Feb 27 2013

A057163 Signature-permutation of a Catalan automorphism: Reflect a rooted plane binary tree; Deutsch's 1998 involution on Dyck paths.

Original entry on oeis.org

0, 1, 3, 2, 8, 7, 6, 5, 4, 22, 21, 20, 18, 17, 19, 16, 15, 13, 12, 14, 11, 10, 9, 64, 63, 62, 59, 58, 61, 57, 55, 50, 49, 54, 48, 46, 45, 60, 56, 53, 47, 44, 52, 43, 41, 36, 35, 40, 34, 32, 31, 51, 42, 39, 33, 30, 38, 29, 27, 26, 37, 28, 25, 24, 23, 196, 195, 194, 190, 189
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2000

Keywords

Comments

Deutsch shows in his 1999 paper that this automorphism maps the number of doublerises of Dyck paths to number of valleys and height of the first peak to the number of returns, i.e., that A126306(n) = A127284(a(n)) and A126307(n) = A057515(a(n)) hold for all n.
The A000108(n-2) n-gon triangularizations can be reflected over n axes of symmetry, which all can be generated by appropriate compositions of the permutations A057161/A057162 and A057163.
Composition with A057164 gives signature permutation for Donaghey's Map M (A057505/A057506). Embeds into itself in scale n:2n+1 as a(n) = A083928(a(A080298(n))). A127302(a(n)) = A127302(n) and A057123(A057163(n)) = A057164(A057123(n)) hold for all n.

Examples

			This involution (self-inverse permutation) of natural numbers is induced when we reflect the rooted plane binary trees encoded by A014486. E.g., we have A014486(5) = 44 (101100 in binary), A014486(7) = 52 (110100 in binary) and these encode the following rooted plane binary trees, which are reflections of each other:
    0   0             0   0
     \ /               \ /
      1   0         0   1
       \ /           \ /
    0   1             1   0
     \ /               \ /
      1                 1
thus a(5)=7 and a(7)=5.
		

Crossrefs

This automorphism conjugates between the car/cdr-flipped variants of other automorphisms, e.g., A057162(n) = a(A057161(a(n))), A069768(n) = a(A069767(a(n))), A069769(n) = a(A057508(a(n))), A069773(n) = a(A057501(a(n))), A069774(n) = a(A057502(a(n))), A069775(n) = a(A057509(a(n))), A069776(n) = a(A057510(a(n))), A069787(n) = a(A057164(a(n))).
Row 1 of tables A122201 and A122202, that is, obtained with FORK (and KROF) transformation from even simpler automorphism *A069770. Cf. A122351.

Programs

  • Maple
    a(n) = A080300(ReflectBinTree(A014486(n)))
    ReflectBinTree := n -> ReflectBinTree2(n)/2; ReflectBinTree2 := n -> (`if`((0 = n),n,ReflectBinTreeAux(A030101(n))));
    ReflectBinTreeAux := proc(n) local a,b; a := ReflectBinTree2(BinTreeLeftBranch(n)); b := ReflectBinTree2(BinTreeRightBranch(n)); RETURN((2^(A070939(b)+A070939(a))) + (b * (2^(A070939(a)))) + a); end;
    NextSubBinTree := proc(nn) local n,z,c; n := nn; c := 0; z := 0; while(c < 1) do z := 2*z + (n mod 2); c := c + (-1)^n; n := floor(n/2); od; RETURN(z); end;
    BinTreeLeftBranch := n -> NextSubBinTree(floor(n/2));
    BinTreeRightBranch := n -> NextSubBinTree(floor(n/(2^(1+A070939(BinTreeLeftBranch(n))))));
  • Mathematica
    A014486Q[0] = True; A014486Q[n_] := Catch[Fold[If[# < 0, Throw[False], If[#2 == 0, # - 1, # + 1]] &, 0, IntegerDigits[n, 2]] == 0]; tree[n_] := Block[{func, num = Append[IntegerDigits[n, 2], 0]}, func := If[num[[1]] == 0, num = Drop[num, 1]; 0, num = Drop[num, 1]; 1[func, func]]; func]; A057163L[n_] := Function[x, FirstPosition[x, FromDigits[Most@Cases[tree[#] /. 1 -> Reverse@*1, 0 | 1, All, Heads -> True], 2]][[1]] - 1 & /@ x][Select[Range[0, 2^n], A014486Q]]; A057163L[11] (* JungHwan Min, Dec 11 2016 *)

Formula

a(n) = A083927(A057164(A057123(n))).

Extensions

Equivalence with Deutsch's 1998 involution realized Dec 15 2006 and entry edited accordingly by Antti Karttunen, Jan 16 2007
Showing 1-10 of 32 results. Next