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.

A244160 a(0)=0, and for n >= 1, a(n) = the largest k such that k-th Catalan number <= n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jun 23 2014

Keywords

Comments

Apart from 0, each n occurs A000245(n) times.
For n >= 1, a(n) gives the largest k such that C(k) <= n, where C(k) stands for the k-th Catalan number, A000108(k).

Examples

			For n=1, the largest k such that C(k) <= 1 is 1, thus a(1) = 1.
For n=2, the largest k such that C(k) <= 2 is 2, thus a(2) = 2.
For n=3, the largest k such that C(k) <= 3 is 2, thus a(3) = 2.
For n=4, the largest k such that C(k) <= 4 is 2, thus a(4) = 2.
For n=5, the largest k such that C(k) <= 5 is 3, thus a(5) = 3.
		

Crossrefs

After zero, one less than A081288.

Programs

  • Mathematica
    MapIndexed[ConstantArray[First@ #2 - 1, #1] &, Differences@ Array[CatalanNumber, 8, 0]] /. {} -> {0} // Flatten (* Michael De Vlieger, Jun 08 2017 *)
    Join[{0},Table[PadRight[{},CatalanNumber[n+1]-CatalanNumber[n],n],{n,6}]// Flatten] (* Harvey P. Dale, Aug 23 2021 *)
  • Python
    from sympy import catalan
    def a(n):
        if n==0: return 0
        i=1
        while True:
            if catalan(i)>n: break
            else: i+=1
        return i - 1
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 08 2017
  • Scheme
    (define (A244160 n) (if (zero? n) n (- (A081288 n) 1)))
    

Formula

a(0) = 0, and for n>=1, a(n) = A081288(n)-1.
For all n>=1, A000108(a(n)) = A081290(n).