login
A244215
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
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, 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, 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
OFFSET
0,3
COMMENTS
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).
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
LINKS
FORMULA
a(n) = A244160(n) - A244160(n-A081290(n)).
For all n >= 1, a(A000108(n)) = n.
PROG
(Scheme) (define (A244215 n) (- (A244160 n) (A244160 (- n (A081290 n)))))
CROSSREFS
A244216 gives the positions of zeros, A244217 the positions of nonzero terms.
Sequence in context: A322133 A274183 A212278 * A255325 A025654 A025648
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jun 23 2014
EXTENSIONS
Name improved by Antti Karttunen, Mar 21 2015
STATUS
approved