cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A255063 Number of times an evil number 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).

Original entry on oeis.org

1, 0, 1, 2, 2, 5, 7, 14, 24, 52, 84, 173, 290, 586, 1038, 2025, 3740, 7177, 13498, 25832, 49027, 93918, 179291, 344128, 660058, 1270590, 2447944, 4728357, 9145214, 17718039, 34365068, 66717630, 129619518, 251953756, 489964171, 953141850, 1854911347
Offset: 0

Views

Author

Antti Karttunen, Feb 14 2015

Keywords

Examples

			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.
		

Crossrefs

Programs

  • PARI
    \\ Compute sequences A255063, A255064 and A255071 at the same time, starting from n=1:
    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); };
    for(n=1,36,write_A255063_and_A255064_and_A255071(n));
    
  • Scheme
    (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)))))
    
  • Scheme
    (define (A255063 n) (add A254113 (A255062 n) (A255061 (+ 1 n))))
    
  • Scheme
    (define (A255063 n) (add (COMPOSE A010059 A255066) (A255062 n) (A255061 (+ 1 n))))

Formula

a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A254113(k).
a(n) = Sum_{k = A255062(n) .. A255061(n+1)} A010059(A255066(k)).
Other identities. For all n >= 1:
a(n) = A255071(n) - A255064(n).