OFFSET
0,3
COMMENTS
For n >= 1, a(n) tells the one-based position of the digit (from the right) where the iteration stopped at, when constructing a Semigreedy Catalan representation of n as described in A244159.
Algorithm for constructing the sequence: Find the largest Catalan number which is less than or equal to n (this is A081290(n) = A000108(k), where k = A244160(n), that is, the corresponding index of that Catalan number), and subtract that from n. Then check whether the previous Catalan number, C(m) = A000108(m), where m = k-1, exceeds the remaining n, and if it does not, then subtract that also from n, and keep on doing the same for lesser and lesser Catalan numbers, comparing and also subtracting them (whenever it is possible without going less than zero) from n, until either n becomes zero, or after subtracting C(1) = 1 from n, it still has not reached zero. In the latter case, find again the largest Catalan number which is less than or equal to remaining n, and start the process again. However, when at some point n finally reaches zero, then the index k of the last Catalan number, A000108(k) which was subtracted from n before it reached zero, is our result, a(n) = k. [Here n = the original value of n, from which we started subtracting initially from].
If n is one of the terms of A197433, meaning that if it can be represented as a sum of distinct Catalan numbers as n = C(i) + C(j) + ... + C(k) (which representation then necessarily is unique), then a(n) = min(i,j,...,k).
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..16796
FORMULA
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jun 25 2014
STATUS
approved