%I #52 Dec 01 2021 03:52:52
%S 0,1,2,2,4,3,3,3,6,5,4,6,5,4,4,4,8,7,6,8,8,5,7,9,7,6,5,7,6,5,5,5,10,9,
%T 8,10,10,7,9,11,12,9,6,10,11,8,10,12,9,8,7,9,9,6,8,10,8,7,6,8,7,6,6,6,
%U 12,11,10,12,12,9,11,13,14,11,8,12,13,10,12,14
%N a(n) is the sum of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n; row sums of A227739 for n >= 1.
%C Like A129594 this sequence utilizes the fact that compositions (i.e., ordered partitions) can be bijectively mapped to (unordered) partitions by taking the partial sums of the list of composants after one has been subtracted from each except the first one. Compositions in turn are mapped to nonnegative integers via the runlength encoding, where the lengths of maximum runs of 0's or 1's in binary representation of n give the composants. See the OEIS Wiki page and the example below.
%C Each n occurs A000041(n) times in total and occurs for the first time at A227368(n) and for the last time at position A000225(n). See further comments and conjectures at A227368 and A227370.
%H Antti Karttunen, <a href="/A227183/b227183.txt">Table of n, a(n) for n = 0..8192</a>
%H A. Karttunen et al., <a href="http://oeis.org/wiki/Runlength_encoding">Run-length encoding</a>, OEIS Wiki.
%H <a href="/index/Par#part">Index entries for sequences related to partitions</a>
%F a(n) = Sum_{i=0..A005811(n)-1} A227189(n,i). [The defining formula]
%F Equivalently, for n>=1, a(n) = Sum_{i=(A173318(n-1)+1)..A173318(n)} A227739(i).
%F a(n) = A227192(n) - A000217(A005811(n)-1).
%F Other identities:
%F a(A129594(n)) = a(n). [This follows from the fact that conjugating a partition doesn't change its total sum]
%F a(A226062(n)) = a(n). [Which is also true for the "Bulgarian operation"]
%F From _Antti Karttunen_, Mar 08 2015: (Start)
%F Can be also obtained by mapping with an appropriate permutation from the sequences giving sizes of each partition (i.e., sum of their parts) computed for other enumerations similar to A227739:
%F a(n) = A036042(A229119(n)).
%F a(n) = A161511(A003188(n)).
%F a(n) = A056239(A243353(n)).
%F a(n) = A243503(1+A075157(n)).
%F (End)
%e 19 has binary expansion "10011", thus the maximal runs of identical bits (scanned from right to left) are [2,2,1]. We subtract one from each after the first one, to get [2,1,0] and then form their partial sums as [2,2+1,2+1+0], which thus maps to unordered partition {2+3+3} which adds to 8. Thus a(19)=8.
%t Table[Function[b, Total@ Accumulate@ Prepend[If[Length@ b > 1, Rest[b] - 1, {}], First@ b] - Boole[n == 0]]@ Map[Length, Split@ Reverse@ IntegerDigits[n, 2]], {n, 0, 79}] // Flatten (* _Michael De Vlieger_, May 09 2017 *)
%o (Scheme, with _Antti Karttunen_'s IntSeq-library):
%o (definec (A227183 n) (let loop ((n n) (i (A005811 n)) (d 0) (s 0)) (cond ((zero? n) s) (else (loop (A163575 n) (- i 1) (expt 1 d) (+ s (* i (- (A136480 n) d))))))))
%o (define (A227183v2 n) (if (zero? n) n (apply + (binexp_to_ascpart n)))) ;; Alternative definition, using the same auxiliary functions as A227184, which are given there.
%o (define (A227183v3 n) (let loop ((i (- (A005811 n) 1)) (s 0)) (cond ((< i 0) s) (else (loop (- i 1) (+ s (A227189bi n i))))))) ;; Another variant which sums the nonzero terms of the row n of array A227189.
%o (define (A227183v4 n) (- (A227192 n) (A000217 (- (A005811 n) 1)))) ;; Yet another variant.
%o ;; As well:
%o (define (A227183v5 n) (add A227739 (+ 1 (A173318 (- n 1))) (A173318 n)))
%o ;; This implements Sum_{i=lowlim..uplim} intfun(i)
%o (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
%o (Python)
%o def A227183(n):
%o '''Sum of parts of the unique unordered partition encoded in the run lengths of the binary expansion of n.'''
%o s = 0
%o b = n%2
%o i = 1
%o while (n != 0):
%o n >>= 1
%o if ((n%2) == b): # Staying in the same run of bits?
%o i += 1
%o else: # The run changes.
%o b = n%2
%o s += i
%o return(s)
%Y Row sums of A227189 and A227739. Cf. A227184 (corresponding products), A227185, A227189, A227192, A129594, A226062, A227368.
%Y Analogous sum sequences computed for other encoding schemes of unordered partitions: A036042, A056239, A161511, A243503. Cf. also A229119, A003188, A075157, A243353 (associated permutations mapping between these schemes).
%K nonn,base,look
%O 0,3
%A _Antti Karttunen_, Jul 05 2013