%I #26 Aug 23 2021 18:42:39
%S 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,
%T 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,
%U 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
%N a(0)=0, and for n >= 1, a(n) = the largest k such that k-th Catalan number <= n.
%C Apart from 0, each n occurs A000245(n) times.
%C 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).
%H Michael De Vlieger, <a href="/A244160/b244160.txt">Table of n, a(n) for n = 0..4861</a>
%F a(0) = 0, and for n>=1, a(n) = A081288(n)-1.
%F For all n>=1, A000108(a(n)) = A081290(n).
%e For n=1, the largest k such that C(k) <= 1 is 1, thus a(1) = 1.
%e For n=2, the largest k such that C(k) <= 2 is 2, thus a(2) = 2.
%e For n=3, the largest k such that C(k) <= 3 is 2, thus a(3) = 2.
%e For n=4, the largest k such that C(k) <= 4 is 2, thus a(4) = 2.
%e For n=5, the largest k such that C(k) <= 5 is 3, thus a(5) = 3.
%t MapIndexed[ConstantArray[First@ #2 - 1, #1] &, Differences@ Array[CatalanNumber, 8, 0]] /. {} -> {0} // Flatten (* _Michael De Vlieger_, Jun 08 2017 *)
%t Join[{0},Table[PadRight[{},CatalanNumber[n+1]-CatalanNumber[n],n],{n,6}]// Flatten] (* _Harvey P. Dale_, Aug 23 2021 *)
%o (Scheme) (define (A244160 n) (if (zero? n) n (- (A081288 n) 1)))
%o (Python)
%o from sympy import catalan
%o def a(n):
%o if n==0: return 0
%o i=1
%o while True:
%o if catalan(i)>n: break
%o else: i+=1
%o return i - 1
%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 08 2017
%Y After zero, one less than A081288.
%Y Cf. A000108, A000245, A081290, A014418, A239903, A244215, A244159, A236859, A126307.
%K nonn
%O 0,3
%A _Antti Karttunen_, Jun 23 2014
|