login
A255126
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).
8
0, 1, 1, 2, 4, 6, 10, 16, 27, 50, 97, 188, 355, 652, 1177, 2126, 3886, 7204, 13501, 25465, 48192, 91411, 173851, 331821, 636035, 1224505, 2366662, 4588124, 8913418, 17338878, 33756650, 65766474, 128239805, 250346859, 489422205, 958304970, 1879145187, 3689012737
OFFSET
0,4
COMMENTS
Also the number of odd numbers in range [A255062(n) .. A255061(n+1)] of A255057 (equally, in A255067). See the sum-formulas.
FORMULA
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A000035(A255057(k)).
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A000035(A255067(k)).
a(n) = A255071(n) - A255125(n).
EXAMPLE
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.
PROG
(PARI) \\ Use the PARI-code given in A255125.
(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))))))))
;; Alternatively:
(define (A255126 n) (add (COMPOSE A000035 A255057) (A255062 n) (A255061 (+ 1 n))))
(define (A255126 n) (add (COMPOSE A000035 A255067) (A255062 n) (A255061 (+ 1 n))))
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 18 2015
STATUS
approved