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 37 results. Next

A082852 a(0)=0, a(n) = A014137(A072643(n)-1).

Original entry on oeis.org

0, 1, 2, 2, 4, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65
Offset: 0

Views

Author

Antti Karttunen, Apr 17 2003

Keywords

Comments

A014137(n) occurs A000108(n+1) times.

Crossrefs

Used to compute A082853. Cf. also A082855.

Programs

  • Mathematica
    a014137[n_] := Sum[CatalanNumber[k], {k, 0, n}];
    a072643[n_] := Module[{i, c, a}, i = c = 0; a = 1; While[n > c, a *= (4*i + 2)/(i + 2); i++; c += a]; i];
    a[n_] := a014137[a072643[n] - 1];
    Table[a[n], {n, 0, 76}] (* Jean-François Alcover, Dec 26 2017 *)
  • Sage
    def A082852(n) :
        i = c = 0; a = 1
        while n > c :
            a *= (4*i+2)/(2+i)
            i += 1; c += a
        return c-a+1
    [A082852(n) for n in (0..76)] # - Peter Luschny, Sep 07 2012
  • Scheme
    (define (A082852 n) (if (zero? n) 0 (A014137 (-1+ (A072643 n)))))
    

A072768 The RASTxx transformation of the sequence A072643.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 4, 4, 5, 5, 5, 5, 4, 4, 5, 6, 5, 6, 5, 4, 4, 5, 6, 6, 6, 6, 5, 4, 4, 5, 6, 6, 7, 6, 6, 5, 4, 5, 5, 6, 6, 7, 7, 6, 6, 5, 5, 5, 6, 6, 6, 7, 7, 7, 6, 6, 6, 5, 5, 6, 7, 6, 7, 7, 7, 7, 6, 7, 6, 5, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 5, 5, 6, 7, 7, 8, 7, 7, 7, 7, 8, 7, 7, 6, 5
Offset: 1

Views

Author

Antti Karttunen, Jun 12 2002

Keywords

Comments

Also, the sizes of the parenthesizations produced by 'cons' combination A072764 and its transpose A072766.
Differs from A071673 first time at the position n=37, where A072768(37) = 4, while A071673(37) = 5. RASTxx(A072768) differs from A071673 first time at the position n=704, which leads to conjecture that the repeated applications of RASTxx starting from A072643 converge towards A071673, the fixed point of RASTxx transformation.
Each value v occurs A000108(v) times. (The term a(0)=0 is not explicitly listed here as to get a better looking triangle).

Crossrefs

Same triangle computed modulo 2: A072770. Permutations: A072643, A071673, A072644, A072645, A072660, A072789. Cf. also A072769, A025581, A002262.

Programs

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

A072649 n occurs Fibonacci(n) times (cf. A000045).

Original entry on oeis.org

1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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
Offset: 1

Views

Author

Antti Karttunen, Jun 02 2002

Keywords

Comments

Number of digits in Zeckendorf-binary representation of n. E.g., the Zeckendorf representation of 12 is 8+3+1, which in binary notation is 10101, which consists of 5 digits. - Clark Kimberling, Jun 05 2004
First position where value n occurs is A000045(n+1), i.e., a(A000045(n)) = n-1, for n >= 2 and a(A000045(n)-1) = n-2, for n >= 3.
This is the number of distinct Fibonacci numbers greater than 0 which are less than or equal to n. - Robert G. Wilson v, Dec 10 2006
The smallest nondecreasing sequence a(n) such that a(Fibonacci(n-1)) = n. - Tanya Khovanova, Jun 20 2007

Examples

			1, 1, then F(2) 2's, then F(3) 3's, then F(4) 4's, ..., then F(k) k's, ...
		

Crossrefs

Cf. A001622 (golden ratio phi), A073010.
Used to construct A003714. Cf. also A002024, A072643, A072648, A072650.
Cf. A131234.
Partial sums: A256966, A256967.

Programs

  • Haskell
    a072649 n = a072649_list !! (n-1)
    a072649_list = f 1 where
       f n = (replicate (fromInteger $ a000045 n) n) ++ f (n+1)
    -- Reinhard Zumkeller, Jul 04 2011
    
  • Maple
    A072649 := proc(n)
        local j;
        for j from ilog[(1+sqrt(5))/2](n) while combinat[fibonacci](j+1)<=n do
        end do;
        j-1
    end proc:
    seq(A072649(n), n=1..120);  # Alois P. Heinz, Mar 18 2013
  • Mathematica
    Table[Table[n, {Fibonacci[n]}], {n, 10}] // Flatten (* Robert G. Wilson v, Jan 14 2007 *)
    a[n_] := Module[{j}, For[j = Floor@Log[GoldenRatio, n], Fibonacci[j+1] <= n, j++]; j-1];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Nov 17 2022, after Alois P. Heinz *)
  • PARI
    a(n) = -1+floor(log(((n+0.2)*sqrt(5)))/log((1+sqrt(5))/2))
    
  • PARI
    a(n)=local(m); if(n<1,0,m=0; until(fibonacci(m)>n,m++); m-2)
    
  • Python
    from sympy import fibonacci
    def a(n):
        if n<1: return 0
        m=0
        while fibonacci(m)<=n: m+=1
        return m-2
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 09 2017
    
  • Python
    def A072649(n):
        a, b, c = 0, 1, -2
        while a <= n:
            a, b = b, a+b
            c += 1
        return c # Chai Wah Wu, Nov 04 2024
    (MIT/GNU Scheme) (define (A072649 n) (let ((b (A072648 n))) (+ -1 b (floor->exact (/ n (A000045 (1+ b))))))) ;; (The implementation below is better)
    
  • Scheme
    (define (A072649 n) (if (<= n 3) n (let loop ((k 5)) (if (> (A000045 k) n) (- k 2) (loop (+ 1 k)))))) ;; (Use this with the memoized implementation of A000045 given under that entry. No floating point arithmetic is involved). - Antti Karttunen, Oct 06 2017

Formula

G.f.: (Sum_{n>1} x^Fibonacci(n))/(1-x). - Michael Somos, Apr 25 2003
From Hieronymus Fischer, May 02 2007: (Start)
a(n) = floor(log_phi((sqrt(5)*n + sqrt(5*n^2+4))/2)) - 1, where phi is A001622.
a(n) = floor(arcsinh(sqrt(5)*n/2)/log(phi)) - 1.
a(n) = A108852(n) - 2. (End)
a(n) = -1 + floor( log_phi( (n+0.2)*sqrt(5) ) ), where log_phi(x) is the logarithm to the base (1+sqrt(5))/2. - Ralf Stephan, May 14 2007
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/(3*sqrt(3)) (A073010). - Amiram Eldar, Feb 18 2024

Extensions

Typo fixed by Charles R Greathouse IV, Oct 28 2009

A072795 A014486-indices of the plane binary trees AND plane general trees whose left subtree is just a stick: \. thus corresponding to the parenthesizations whose first element (of the top-level list) is an empty parenthesization: ().

Original entry on oeis.org

1, 2, 4, 5, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 197, 198, 199
Offset: 0

Views

Author

Antti Karttunen Jun 12 2002

Keywords

Comments

This sequence is induced by the 'flipped form' of the function 'list': (define (flippedlist x) (cons '() x)) when it acts on symbolless S-expressions encoded by A014486/A063171.

Crossrefs

Gives in A063171 positions of the terms which begin with digits 10...
Column 0 of A072764, row 0 of A072766, column 1 of A085201. Complement: A081291. Cf. A085223.

Programs

  • Mathematica
    Range[0, Length[#]-1] + CatalanNumber[#] & [Flatten[Array[Table[#, CatalanNumber[#]] &, 7, 0]]] (* Paolo Xausa, Mar 01 2024 *)

Formula

a(n) = n + A000108(A072643(n)) = A069770(A057548(n)) = A080300(A083937(n))

A084556 n occurs n! times.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
Offset: 0

Views

Author

Antti Karttunen, Jun 02 2003

Keywords

Comments

Also minimum i such that A007489(i) >= n.
For n>=1, a(n) gives the length of the n-th permutation in the sequences like A030298 & A030496.

Crossrefs

First differences of A084555. Used to compute A084557. Differs from A084506 first time at the 130th term, where A084506(130) = 6, while A084556(130) = 5. Cf. also A002024, A072643, A072649, A090529.

Programs

  • Mathematica
    Flatten[ Table[#, {#!}] & /@ Range[0, 5]]

A071673 Sequence a(n) obtained by setting a(0) = 0; then reading the table T(x,y)=a(x)+a(y)+1 in antidiagonal fashion.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 4, 4, 5, 5, 5, 5, 4, 4, 5, 6, 5, 6, 5, 4, 4, 5, 6, 6, 6, 6, 5, 4, 5, 5, 6, 6, 7, 6, 6, 5, 5, 5, 6, 6, 6, 7, 7, 6, 6, 6, 5, 4, 6, 7, 6, 7, 7, 7, 6, 7, 6, 4, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 6, 6, 7, 8, 7, 7, 7, 8, 7, 6, 6, 5, 6, 6, 7, 6, 8, 8, 7, 7, 8, 8, 6, 7, 6, 6
Offset: 0

Views

Author

Antti Karttunen, May 30 2002

Keywords

Comments

The fixed point of RASTxx transformation. The repeated applications of RASTxx starting from A072643 seem to converge toward this sequence. Compare to A072768 from which this differs first time at the position n=37, where A072768(37) = 4, while A071673(37) = 5.
Each term k occurs A000108(k) times, and maximal position where k occurs is A072638(k).
The size of each Catalan structure encoded by the corresponding terms in triangles A071671 & A071672 (i.e., the number of digits / 2), as obtained with the global ranking/unranking scheme presented in A071651-A071654.

Examples

			The first 15 rows of this irregular triangular table:
               0,
               1,
              2, 2,
             3, 3, 3,
            3, 4, 4, 3,
           4, 4, 5, 4, 4,
          4, 5, 5, 5, 5, 4,
         4, 5, 6, 5, 6, 5, 4,
        4, 5, 6, 6, 6, 6, 5, 4,
       5, 5, 6, 6, 7, 6, 6, 5, 5,
      5, 6, 6, 6, 7, 7, 6, 6, 6, 5,
     4, 6, 7, 6, 7, 7, 7, 6, 7, 6, 4,
    5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5,
   5, 6, 6, 7, 8, 7, 7, 7, 8, 7, 6, 6, 5,
  6, 6, 7, 6, 8, 8, 7, 7, 8, 8, 6, 7, 6, 6
etc.
E.g., we have
  a(1) = T(0,0) = a(0) + a(0) + 1 = 1,
  a(2) = T(1,0) = a(1) + a(0) + 1 = 2,
  a(3) = T(0,1) = a(0) + a(1) + 1 = 2,
  a(4) = T(2,0) = a(2) + a(0) + 1 = 3, etc.
		

Crossrefs

Same triangle computed modulo 2: A071674.
Permutations of this sequence include: A072643, A072644, A072645, A072660, A072768, A072789, A075167.

Programs

Formula

a(0) = 0, a(n) = 1 + a(A025581(n-1)) + a(A002262(n-1)) = 1 + a(A004736(n)) + a(A002260(n)).

Extensions

Self-referential definition added Jun 03 2002
Term a(0) = 0 prepended and the Example-section amended by Antti Karttunen, Aug 17 2021

A072644 Size of the parenthesizations obtained with the global ranking/unranking scheme A072634-A072637.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 4, 4, 3, 4, 3, 4, 5, 5, 5, 5, 4, 4, 5, 5, 4, 5, 5, 6, 6, 6, 6, 6, 6, 7, 6, 7, 4, 5, 4, 5, 6, 6, 6, 6, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 7, 7, 8, 8, 7, 8, 8, 9, 5, 4, 6, 5, 5, 4, 6, 5, 7, 6, 7, 6, 7, 6, 7, 6, 5, 6, 6, 7, 6, 6, 7, 7, 7, 8, 7, 8, 8, 8, 8, 8, 8, 7, 8, 7, 8, 7, 8, 7
Offset: 0

Views

Author

Antti Karttunen, Jun 02 2002

Keywords

Crossrefs

Cf. A072635 & A072637. A072644(n) = A029837(A014486(A072635(n))+1)/2 or = A029837(A014486(A072637(n))+1)/2 [A029837(n+1) gives the binary width of n].
Each value v occurs A000108(v) times. The maximum position for value v to occur is A072639(v). Permutations: A071673, A072643, A072645, A072660.

A125985 Signature-permutation of Vaillé's 1997 bijection on 'bridges' (Dyck paths).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 02 2007

Keywords

Comments

Vaillé shows in 1997 paper that this automorphism transforms a 'derivation' of a Dyck path to its 'compression', i.e., in OEIS terms, A125985(A126310(n)) = A126309(A125985(n)) holds for all n. He also proves that A057515(A125985(n)) = A126307(n) and A057514(A125985(n)) = A072643(n) - A057514(n) + 1 (the latter identity for all n >= 1).

Crossrefs

Inverse: A125986. The number of cycles, maximum cycle sizes and LCM's of all cycle sizes in range [A014137(n-1)..A014138(n-1)] of this permutation are given by A126291, A126292 and A126293. The fixed points are given by A126300/A126301.

Programs

  • Scheme
    (define (A125985 n) (A080300 (rising-list->binexp (A125985-aux2 (A014486 n)))))
    (define (A125985-aux2 n) (let loop ((lists (A125985-aux1 n)) (z (list)) (m 1)) (if (null? lists) z (loop (cdr lists) (m-join z (car lists) m) (+ m 1)))))
    (define (A125985-aux1 n) (if (zero? n) (list) (let ((begin_from (<< 1 (- (- (A000523 n) (A090996 n)) 1)))) (let loop ((s (A090996 n)) (t 0) (nth_list 1) (p begin_from) (b (if (= 0 (A004198bi n begin_from)) 0 1)) (lists (list (list)))) (cond ((< s 1) (cond ((< p 1) (reverse! lists)) (else (loop (- t (- 1 b)) b (+ 1 nth_list) (>> p 1) (if (= 0 (A004198bi n (>> p 1))) 0 1) (cons (list (+ b 1 nth_list)) lists))))) (else (loop (- s (- 1 b)) (+ t b) nth_list (>> p 1) (if (= 0 (A004198bi n (>> p 1))) 0 1) (cons (cons (+ b nth_list) (car lists)) (cdr lists)))))))))
    (define (A125985-aux2 n) (let loop ((lists (A125985-aux1 n)) (z (list)) (m 1)) (if (null? lists) z (loop (cdr lists) (m-join z (car lists) m) (+ m 1)))))
    (define (m-join a b m) (let loop ((a a) (b b) (c (list))) (cond ((and (not (pair? a)) (not (pair? b))) (reverse! c)) ((not (pair? a)) (loop a (cdr b) (cons (car b) c))) ((not (pair? b)) (loop (cdr a) b (cons (car a) c))) ((equal? (car a) (car b)) (loop (cdr a) (cdr b) (cons (car a) c))) ((> (car b) m) (loop a (cdr b) (cons (car b) c))) (else (loop (cdr a) b (cons (car a) c))))))
    (define (rising-list->binexp rising-list) (let loop ((s 0) (i 0) (h 0) (fs rising-list)) (cond ((null? fs) (+ s (<< (- (<< 1 h) 1) i))) ((> (car fs) h) (loop s (+ i 1) (car fs) (cdr fs))) (else (loop (+ s (<< (- (<< 1 (+ 1 (- h (car fs)))) 1) i)) (+ i 2 (- h (car fs))) (car fs) (cdr fs))))))
    (define (>> n i) (if (zero? i) n (>> (floor->exact (/ n 2)) (- i 1))))
    (define (<< n i) (if (<= i 0) (>> n (- i)) (<< (+ n n) (- i 1))))

A075167 Number of edges in each rooted plane tree produced with the unranking algorithm presented in A075166, which is based on prime factorization.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 3, 3, 4, 5, 4, 6, 5, 4, 3, 7, 4, 8, 5, 5, 6, 9, 4, 4, 7, 4, 6, 10, 5, 11, 4, 6, 8, 5, 5, 12, 9, 7, 5, 13, 6, 14, 7, 5, 10, 15, 5, 5, 5, 8, 8, 16, 5, 6, 6, 9, 11, 17, 6, 18, 12, 6, 4, 7, 7, 19, 9, 10, 6, 20, 5, 21, 13, 5, 10, 6, 8, 22, 6, 4, 14, 23, 7, 8, 15, 11, 7, 24, 6, 7, 11
Offset: 1

Views

Author

Antti Karttunen, Sep 13 2002

Keywords

Comments

Each n occurs A000108(n) times in total.

Crossrefs

Permutation of A072643 and A106457.
A253782 gives the positions where this sequence differs from A252464 (first time at n=16).
Cf. also A106490.

Formula

a(n) = A106457(A106442(n)). - Antti Karttunen, May 09 2005
From Antti Karttunen, Jan 16 2015: (Start)
a(1) = 0; for n>1: a(n) = a(A071178(n)) + (A061395(n) - A061395(A051119(n))) + A253783(A051119(n)).
Other identities.
For all n >= 2, a(n) = A055642(A075166(n))/2. [Half of the number of decimal digits in A075166(n).]
For all n >= 2, a(n) = A029837(1+A075165(n))/2. [Half of the binary width of A075165(n).]
For all n >= 1, a(n) = A000120(A075165(n)). [Thus also the binary weight of A075165(n), because half of the bits are zeros.]
(End)

Extensions

More terms from Antti Karttunen, May 09 2005
Showing 1-10 of 37 results. Next