login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the sum of digits in A239903(n).
6

%I #33 Feb 20 2024 02:28:42

%S 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,

%T 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,

%U 7,8,4,5,5,6,7,6,7,8,9,7,8,9,10,11,3,4

%N a(n) is the sum of digits in A239903(n).

%H Antti Karttunen, <a href="/A236855/b236855.txt">Table of n, a(n) for n = 0..16796</a>

%F a(n) = A034968(x) - A060130(x), where x = A071155(A081291(n)).

%F For up to n = A000108(11)-2 = 58784, a(n) = A007953(A239903(n)).

%F 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).

%F For each n, a(n) >= A000217(A236859(n)).

%e As the 0th Catalan String is empty, indicated by A239903(0)=0, a(0)=0.

%e As the 18th Catalan String is [1,0,1,2] (A239903(18)=1012), a(18) = 1+0+1+2 = 4.

%e 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.

%t 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 &]]]];

%t A236855list[6] (* Generates C(6) terms *) (* _Paolo Xausa_, Feb 19 2024 *)

%o (Scheme)

%o (define (A236855 n) (apply + (A239903raw n)))

%o (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))))))))

%o ;; Alternative definition:

%o (define (A236855 n) (let ((x (A071155 (A081291 n)))) (- (A034968 x) (A060130 x))))

%Y Cf. A239903, A014420, A237449, A236859, A009766, A071155, A081291, A034968, A060130.

%K nonn,base

%O 0,4

%A _Antti Karttunen_, Apr 18 2014