OFFSET
0,4
FORMULA
EXAMPLE
For n=0 we count the evil numbers (A001969) found in range A255056(0..0), and A255056(0) = 0 is an evil number, thus a(0) = 1.
For n=1 we count the evil numbers in range A255056(1..1), and A255056(1) = 2 is not an evil number, thus a(1) = 0.
For n=2 we look at the numbers in range A255056(2..3), i.e. 4 and 6 and while 4 is not an evil number, 6 is, thus a(2) = 1.
For n=5 we look at the numbers in range A255056(12..20) which are (32, 36, 42, 46, 50, 54, 58, 60, 62). Or we take them in the order they come when iterating A236840 (as in A255066(12..20): 62, 60, 58, 54, 50, 46, 42, 36, 32), that is, 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 and finally m(36) = 32 which is (2^5). Of the nine numbers encountered, only 60, 58, 54, 46 and 36 are evil numbers, thus a(5) = 5.
PROG
(PARI)
A005811(n) = hammingweight(bitxor(n, n\2));
write_A255063_and_A255064_and_A255071(n) = { my(k, i, s63, s64); k = (2^(n+1))-2; i = 1; s63 = 0; s64 = 0; while(1, if((hammingweight(k)%2), s64++, s63++); k = k - A005811(k); if(!bitand(k+1, k+2), break, i++)); write("b255063.txt", n, " ", s63); write("b255064.txt", n, " ", s64); write("b255071.txt", n, " ", i); };
(Scheme, different versions)
(define (A255063 n) (if (zero? n) 1 (let loop ((i (- (expt 2 (+ 1 n)) 4)) (s (modulo (+ 1 n) 2))) (cond ((pow2? (+ 2 i)) s) (else (loop (- i (A005811 i)) (+ s (A010059 i))))))))
(define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1)))))
;; Alternatively:
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 14 2015
STATUS
approved