login
Run length transform of A008619 (floor(n/2)+1).
4

%I #21 Sep 28 2021 01:21:48

%S 1,1,1,2,1,1,2,2,1,1,1,2,2,2,2,3,1,1,1,2,1,1,2,2,2,2,2,4,2,2,3,3,1,1,

%T 1,2,1,1,2,2,1,1,1,2,2,2,2,3,2,2,2,4,2,2,4,4,2,2,2,4,3,3,3,4,1,1,1,2,

%U 1,1,2,2,1,1,1,2,2,2,2,3,1,1,1,2,1,1,2,2,2,2,2,4,2,2,3,3,2,2,2,4,2,2,4,4,2,2,2,4,4,4,4,6,2,2,2,4,2,2,4,4,3

%N Run length transform of A008619 (floor(n/2)+1).

%H Antti Karttunen, <a href="/A278161/b278161.txt">Table of n, a(n) for n = 0..16383</a>

%H Chai Wah Wu, <a href="https://arxiv.org/abs/1610.06166">Sums of products of binomial coefficients mod 2 and run length transforms of sequences</a>, arXiv:1610.06166 [math.CO], 2016.

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = A046951(A005940(1+n)), a(A156552(n)) = A046951(n).

%F a(n) = Sum_{k=0..n} ((binomial(n+3k,6k)*binomial(n,k)) mod 2). - _Chai Wah Wu_, Nov 19 2019

%e n=111 is "1101111" in binary, which has two runs of 1-bits: the other has length 2, and the other has length 4, thus we take the product A008619(2)*A008619(4) = (floor(2/2)+1) * (floor(4/2)+1) = 2*3, which is the result, so a(111) = 6.

%t f[n_] := Floor[n/2] + 1; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 120}] (* _Jean-François Alcover_, Jul 11 2017 *)

%o (Scheme)

%o (define (A278161 n) (fold-left (lambda (a r) (* a (A008619 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))

%o (define (A008619 n) (+ 1 (/ (- n (modulo n 2)) 2)))

%o ;; See A227349 for the required other functions.

%o (Python)

%o def A278161(n): return sum(int(not (~(n+3*k) & 6*k) | (~n & k)) for k in range(n+1)) # _Chai Wah Wu_, Sep 28 2021

%Y Cf. A005940, A008619, A046951, A156552.

%Y Cf. A106737, A227349 for other run length transforms, and also A278222.

%K nonn,base

%O 0,4

%A _Antti Karttunen_, Nov 14 2016