login
a(0)=0, and for n>=1, if n is the k-th Catalan number (A000108(k)), a(n) = k, otherwise the difference of the indices of the two largest Catalan numbers whose sum is less than or equal to n: a(n) = A244160(n) - A244160(n-A081290(n)).
4

%I #22 Mar 25 2015 02:01:50

%S 0,1,2,1,0,3,2,1,1,1,0,0,0,0,4,3,2,2,2,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,

%T 0,0,0,0,0,0,0,0,5,4,3,3,3,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,

%U 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6

%N a(0)=0, and for n>=1, if n is the k-th Catalan number (A000108(k)), a(n) = k, otherwise the difference of the indices of the two largest Catalan numbers whose sum is less than or equal to n: a(n) = A244160(n) - A244160(n-A081290(n)).

%C After a(0), if the leftmost digit in the Greedy Catalan Base representation of n [= A014418(n)] is larger than 1, then a(n) = 0, otherwise one more than the distance to the next nonzero digit to the right, or to the end of the numeral, if no more nonzero digits are present (i.e., if n is one of the Catalan numbers).

%C When searching for the two largest Catalan numbers whose sum is less than or equal to n, we first maximize the larger of those two numbers, which is A081290(n) = A000108(A244160(n)), after which we will find the next largest Catalan number that still "fits into" n. - _Antti Karttunen_, Mar 21 2015

%H Antti Karttunen, <a href="/A244215/b244215.txt">Table of n, a(n) for n = 0..4862</a>

%F a(n) = A244160(n) - A244160(n-A081290(n)).

%F For all n >= 1, a(A000108(n)) = n.

%o (Scheme) (define (A244215 n) (- (A244160 n) (A244160 (- n (A081290 n)))))

%Y A244216 gives the positions of zeros, A244217 the positions of nonzero terms.

%Y Cf. A000108, A014418, A081290, A244160, A163510.

%K nonn

%O 0,3

%A _Antti Karttunen_, Jun 23 2014

%E Name improved by _Antti Karttunen_, Mar 21 2015