OFFSET
0,3
COMMENTS
Row (partition) sums of A125106.
a(n) is also the weight (= sum of parts) of the integer partition having viabin number n. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [2,2,2,1]. The southeast border of its Ferrers board yields 10100, leading to the viabin number 20. - Emeric Deutsch, Jul 24 2017
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..8192
FORMULA
a(0) = 0; a(2n) = a(n) + A000120(n); a(2n+1) = a(n) + 1.
From Antti Karttunen, Jun 28 2014: (Start)
Can be also obtained by mapping with an appropriate permutation from the lists of partition sizes computed for other enumerations similar to A125106:
(End)
EXAMPLE
For n = 5, the binary representation of 2n is 1010; the 1...0 pairs are 10xx, 1xx0, and xx10, so a(5) = 3.
MATHEMATICA
a[0] = 0; a[n_] := If[EvenQ[n], a[n/2] + DigitCount[n/2, 2, 1], a[(n-1)/2] + 1]; Array[a, 93, 0] (* Jean-François Alcover, Sep 09 2017 *)
PROG
(PARI) a(n)=local(t, k); t=0; k=1; while(n>0, if(n%2==0, k++, t+=k); n\=2); t
(Scheme)
;; Two variants, the recursive one requiring memoizing definec-macro from Antti Karttunen's IntSeq-library.
(define (A161511 n) (let loop ((n n) (i 1) (s 0)) (cond ((zero? n) s) ((even? n) (loop (/ n 2) (+ i 1) s)) (else (loop (/ (- n 1) 2) i (+ s i))))))
(definec (A161511 n) (cond ((zero? n) n) ((even? n) (+ (A000120 n) (A161511 (/ n 2)))) (else (+ 1 (A161511 (/ (- n 1) 2))))))
;; Antti Karttunen, Jun 28 2014
(Python)
def A161511(n):
a, b = 0, 0
for i, j in enumerate(bin(n)[:1:-1], 1):
if int(j):
a += i-b
b += 1
return a # Chai Wah Wu, Jul 26 2023
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Franklin T. Adams-Watters, Jun 11 2009
STATUS
approved