login
Binary counter with intermittent bits. Starting at zero the counter attempts to increment by 1 at each step but each bit in the counter alternately accepts and rejects requests to toggle.
3

%I #11 Mar 04 2020 03:25:16

%S 0,1,3,6,6,7,13,12,12,13,15,26,26,27,25,24,24,25,27,30,30,31,53,52,52,

%T 53,55,50,50,51,49,48,48,49,51,54,54,55,61,60,60,61,63,106,106,107,

%U 105,104

%N Binary counter with intermittent bits. Starting at zero the counter attempts to increment by 1 at each step but each bit in the counter alternately accepts and rejects requests to toggle.

%C A simple scatter plot reveals a self-similar structure that resembles flying geese.

%C Ignoring the initial zero term, split the sequence into rows of increasing binary magnitude such that the terms in row m satisfy 2^m <= a(n) < 2^(m+1).

%C 0: 1,

%C 1: 3,

%C 2: 6,6,7,

%C 3: 13,12,12,13,15,

%C 4: 26,26,27,25,24,24,25,27,30,30,31,

%C 5: 53,52,52,53,55,50,50,51,49,48,48,49,51,54,54,55,61,60,60,61,63,

%C Then,

%C Row m starts at n = A005578(m+1) in the original sequence

%C The first term in row m is A081254(m)

%C The last term in row m is 2^(m+1)-1

%C The number of terms in row m is A001045(m+1)

%C The number of distinct terms in row m is A005578(m)

%C The number of ascending runs in row m is A005578(m)

%C The number of non-ascending runs in row m is A005578(m)

%C The number of descending runs in row m is A052950(m)

%C The number of non-descending runs in row m is A005578(m-1)

%C The sum of terms in row m is A178747(m)

%C The total number of '1' bits in the terms of row n is A178748(m)

%H D. Scambler, <a href="/A178746/b178746.txt">Table of n, a(n) for n = 0..1024</a>

%F If n is a power of 2, a(n) = n*3/2. Lim(a(n)/n) = 3/2.

%e 0 -> low bit toggles -> 1 -> should be 2 but low bit does not toggle -> 3 -> should be 4 but 2nd-lowest bit does not toggle -> 6 -> should be 7 but low bit does not toggle -> 6 -> low bit toggles -> 7

%o (PARI) seq(n)={my(a=vector(n+1), f=0, p=0); for(i=2, #a, my(b=bitxor(p+1,p)); f=bitxor(f,b); p=bitxor(p, bitand(b,f)); a[i]=p); a} \\ _Andrew Howroyd_, Mar 03 2020

%Y Cf. A178747 sum of terms in rows of a(n), A178748 total number of '1' bits in the terms of rows of a(n).

%K nonn,look

%O 0,3

%A _David Scambler_, Jun 08 2010