Some facts about sequence A014418 ("Greedy Catalan Base representation of n") with short proofs. From Antti Karttunen, June 02 2014. - No digits larger than 3 will appear, because C(n+1)/C(n) approaches 4 from below, but never reaches it. [C(n) is the n-th Catalan number, A000108(n)]. - '3' digits cannot appear earlier than at the fifth digit-position from the right, the first example being a(126) = 30000. Note that because C(4) = 14, it cannot contain 3, as that would be pre-empted by the position at its left, the fifth-digit position standing for the value C(5) = 42 = 3*14. Similarly, for the third rightmost position, standing for value C(3) = 5, we see that it cannot contain 3, because 3*15 = 14+1, and similarly, C(2) = 2, and 3*2 = 5+1. On the other hand, 3*42 = 125 < 132 = C(6) (and likewise for all larger Catalan numbers), thus 3's may appear at any digit position which is the five or more steps away from the right edge of numeral. - The last digit is always either 0 or 1, as the penultimate digit position, standing for value C(2)=2 pre-empts any larger values for the last digit. (See also the sequences A244222 and A244223 which give the corresponding k for "even" and "odd" representations). - No term ends with ...21, as 2*2 + 1 = 5, the value for the third digit position from the right, which will thus pre-empt that possibility. - No two "odd" terms may occur next to each other, because the immediately preceding term of ...1 must have a representation ...0, and from above we see that the odd terms must end either as ...01 or ...11, which when incremented by one results ...10 or ...20 respectively. - Sequence A197433 gives all such k that a(k) = A239903(k), or more precisely, such k, that the underlying strings of digits/numbers are same, meaning that the Scheme-functions A014418raw and A239903raw shown below return precisely the same lists of numbers. Proof: consider a square array, A030237, (which is just an array A009766 in different guise that A239903raw is essentially using) at below. Its left edge consists of successive Catalan numbers. All the rows are genuinely growing, except the row 1, which consists of 1's only. Thus if we take k terms from the beginning of such row it must be different from k * {the first term of that row}. On the other hand, the terms of A014418 never end with a digit larger than 1 (see above), so this cannot happen even there. So only times the equivalence A014418raw(n) = A239903raw(n) is true is when n is a sum of distinct Catalan numbers, i.e. one of the terms of A197433 (whose characteristic function is A176137), as then A239903raw selects at most one term from the beginning of each row. Row Terms on that row 1 | 1 1 1 1 1 ... 2 | 2 3 4 5 6 ... 3 | 5 9 14 20 27 ... 4 | 14 28 48 75 110 ... 5 | 42 90 165 275 429 ... 6 | 132 297 572 1001 1638 ... (define (A014418raw_vector n) (if (zero? n) (make-vector 0) (let ((catbasevec (make-vector (A244160 n) 0))) (let loop ((n n)) (cond ((zero? n) (vector-reverse catbasevec)) (else (let ((k (A244160 n))) (vector-set! catbasevec (- k 1) (+ 1 (vector-ref catbasevec (- k 1)))) (loop (- n (A000108 k))) ) ) ) ) ) ) ) (define (A014418raw n) (vector->list (A014418raw_vector n))) (definec (A239903raw n) (if (zero? n) (list) (let loop ((n n) ;; First to be subtracted from n is A081290(n) (row (A244160 n)) (col (- (A244160 n) 1)) (srow (- (A244160 n) 1)) (catstring (list 0)) ) (cond ((or (zero? row) (negative? col)) (reverse! (cdr catstring))) ((> (A009766tr row col) n) (loop n srow (- col 1) (- srow 1) (cons 0 catstring))) ;; One row up... (else (loop (- n (A009766tr row col)) (+ row 1) col srow (cons (+ 1 (car catstring)) (cdr catstring)))) ) ) ) ) (define (A009766tr r m) (if (or (> m r) (< m 0)) 0 (/ (* (1+ (- r m)) (A000142 (+ r m))) (* (A000142 r) (A000142 m) (1+ r)) ) ) )