A244160 a(0)=0, and for n >= 1, a(n) = the largest k such that k-th Catalan number <= n.
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
Keywords
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.
Links
- Michael De Vlieger, Table of n, a(n) for n = 0..4861
Crossrefs
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)))
Comments