login
A236855
a(n) is the sum of digits in A239903(n).
6
0, 1, 1, 2, 3, 1, 2, 2, 3, 4, 3, 4, 5, 6, 1, 2, 2, 3, 4, 2, 3, 3, 4, 5, 4, 5, 6, 7, 3, 4, 4, 5, 6, 5, 6, 7, 8, 6, 7, 8, 9, 10, 1, 2, 2, 3, 4, 2, 3, 3, 4, 5, 4, 5, 6, 7, 2, 3, 3, 4, 5, 3, 4, 4, 5, 6, 5, 6, 7, 8, 4, 5, 5, 6, 7, 6, 7, 8, 9, 7, 8, 9, 10, 11, 3, 4
OFFSET
0,4
LINKS
FORMULA
a(n) = A034968(x) - A060130(x), where x = A071155(A081291(n)).
For up to n = A000108(11)-2 = 58784, a(n) = A007953(A239903(n)).
Catalan numbers, A000108, give the positions of ones, and the n-th triangular number occurs for the first time at the position immediately before that, i.e., a(A001453(n)) = A000217(n-1).
For each n, a(n) >= A000217(A236859(n)).
EXAMPLE
As the 0th Catalan String is empty, indicated by A239903(0)=0, a(0)=0.
As the 18th Catalan String is [1,0,1,2] (A239903(18)=1012), a(18) = 1+0+1+2 = 4.
Note that although the range of validity of A239903 is inherently limited by the decimal representation employed, it doesn't matter here: We have a(58785) = 55, as the corresponding 58785th Catalan String is [1,2,3,4,5,6,7,8,9,10], even though A239903 cannot represent that unambiguously.
MATHEMATICA
A236855list[m_] := With[{r = 2*Range[2, m]-1}, Reverse[Map[Total[r-#] &, Select[Subsets[Range[2, 2*m-1], {m-1}], Min[r-#] >= 0 &]]]];
A236855list[6] (* Generates C(6) terms *) (* Paolo Xausa, Feb 19 2024 *)
PROG
(Scheme)
(define (A236855 n) (apply + (A239903raw n)))
(define (A239903raw n) (if (zero? n) (list) (let loop ((n n) (row (- (A081288 n) 1)) (col (- (A081288 n) 2)) (srow (- (A081288 n) 2)) (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))) (else (loop (- n (A009766tr row col)) (+ row 1) col srow (cons (+ 1 (car catstring)) (cdr catstring))))))))
;; Alternative definition:
(define (A236855 n) (let ((x (A071155 (A081291 n)))) (- (A034968 x) (A060130 x))))
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Apr 18 2014
STATUS
approved