login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A218542
Number of times when an even number is encountered, when going from 2^(n+1)-1 to (2^n)-1 using the iterative process described in A071542.
11
1, 0, 1, 1, 2, 3, 8, 12, 23, 44, 86, 163, 308, 576, 1074, 1991, 3680, 6800, 12626, 23644, 44751, 85567, 164941, 319694, 621671, 1211197, 2362808, 4614173, 9018299, 17635055, 34486330, 67408501, 131642673, 256795173, 500346954, 973913365, 1894371802, 3683559071
OFFSET
0,5
COMMENTS
Ratio a(n)/A213709(n) develops as: 1, 0, 0.5, 0.333..., 0.4, 0.333..., 0.471..., 0.400..., 0.426..., 0.449..., 0.480..., 0.494..., 0.502..., 0.501..., 0.497..., 0.489..., 0.479..., 0.469..., 0.461..., 0.455..., 0.453..., 0.454..., 0.458..., 0.464..., 0.469..., 0.475..., 0.480..., 0.484..., 0.488..., 0.492..., 0.496..., 0.499..., 0.502..., 0.503..., 0.505..., 0.505..., 0.505..., 0.505..., 0.505..., 0.504..., 0.504..., 0.503..., 0.503..., 0.502..., 0.502..., 0.502..., 0.503..., 0.503... (See further comments at A218543).
LINKS
FORMULA
a(n) = Sum_{i=A218600(n) .. (A218600(n+1)-1)} A213728(i).
a(n) = A213709(n) - A218543(n).
EXAMPLE
(2^0)-1 (0) is reached from (2^1)-1 (1) with one step by subtracting A000120(1) from 1. Zero is an even number, so a(0)=1.
(2^1)-1 (1) is reached from (2^2)-1 (3) with one step by subtracting A000120(3) from 3. One is not an even number, so a(1)=0.
(2^2)-1 (3) is reached from (2^3)-1 (7) with two steps by first subtracting A000120(7) from 7 -> 4, and then subtracting A000120(4) from 4 -> 3. Four is an even number, but three is not, so a(2)=1.
PROG
(Scheme with memoizing definec-macro): (definec (A218542 n) (if (zero? n) 1 (let loop ((i (- (expt 2 (1+ n)) n 2)) (s 0)) (cond ((pow2? (1+ i)) (+ s (- 1 (modulo i 2)))) (else (loop (- i (A000120 i)) (+ s (- 1 (modulo i 2)))))))))
(define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1))))) ;; A004198 is bitwise AND
;; Or with a summing-function add:
(define (A218542v2 n) (add A213728 (A218600 n) (-1+ (A218600 (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
Cf. A219662 (analogous sequence for factorial number system).
Sequence in context: A350440 A115449 A303851 * A194452 A242516 A282281
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 02 2012
EXTENSIONS
More terms from Antti Karttunen, Jun 05 2013
STATUS
approved