%I #19 Feb 19 2021 10:42:36
%S 0,1,1,2,4,6,10,16,27,50,97,188,355,652,1177,2126,3886,7204,13501,
%T 25465,48192,91411,173851,331821,636035,1224505,2366662,4588124,
%U 8913418,17338878,33756650,65766474,128239805,250346859,489422205,958304970,1879145187,3689012737
%N Number of times a number of the form 4n+2 is encountered when iterating from 2^(n+1)-2 to (2^n)-2 with the map x -> x - (number of runs in binary representation of x).
%C Also the number of odd numbers in range [A255062(n) .. A255061(n+1)] of A255057 (equally, in A255067). See the sum-formulas.
%F a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A000035(A255057(k)).
%F a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A000035(A255067(k)).
%F a(n) = A255071(n) - A255125(n).
%e For n=5 we start iterating with map m(n) = A236840(n) from the initial value (2^(5+1))-2 = 62. Thus we get m(62) = 60, m(60) = 58, m(58) = 54, m(54) = 50, m(50) = 46, m(46) = 42, m(42) = 36, m(36) = 32 and finally m(32) = 30, which is (2^5)-2. Of the nine numbers encountered, only 58, 54, 50, 46, 42 and 30 are of the form 4n+2, thus a(5) = 6. Note that the initial value 2^(n+1)-2 is not included in the cases, but the final (2^n) - 2 is.
%o (PARI) \\ Use the PARI-code given in A255125.
%o (Scheme) (define (A255126 n) (if (zero? n) n (let loop ((i (- (expt 2 (+ 1 n)) 4)) (s 1)) (cond ((pow2? (+ 2 i)) s) (else (loop (- i (A005811 i)) (+ s (A021913 i))))))))
%o ;; Alternatively:
%o (define (A255126 n) (add (COMPOSE A000035 A255057) (A255062 n) (A255061 (+ 1 n))))
%o (define (A255126 n) (add (COMPOSE A000035 A255067) (A255062 n) (A255061 (+ 1 n))))
%o (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
%Y Cf. A000035, A005811, A021913, A236840, A255057, A255061, A255062, A255067, A255071, A255125.
%Y Similar sequences: A218543, A255064.
%K nonn
%O 0,4
%A _Antti Karttunen_, Feb 18 2015
|