[seqfan] Re: Switching Binary Digits And Runs Of Digits

Maximilian Hasler maximilian.hasler at gmail.com
Mon Oct 19 06:39:11 CEST 2009


Seq'Fans,
Sorry for flooding your mail boxes, but I wanted to have this bug fixed:
Using the transformations A and B described in

> Sun, Oct 18, 2009 at 10:26 AM, Leroy Quet:
http://list.seqfan.eu/pipermail/seqfan/2009-October/002577.html

a correct (maybe not shortest) way to go from
START = [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1]
to END = [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0]
is as follows:

/* note the symmetry */
do(START,[2,2,6,4,-5,6,1,-1,-6,5,-4,-6,-2,-2])

START = [0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1]
A[2]:   [0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1]
B :     [0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1]
A[2]:   [0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1]
B :     [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1]
A[6]:   [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]
B :     [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
A[4]:   [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
B :     [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]
A[-5]:  [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
B :     [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
A[6]:   [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
B :     [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] (fixed point)
A[1]:   [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
B :     [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1]
A[-1]:  [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
B :     [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0] (fixed point)
A[-6]:  [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]
B :     [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]
A[5]:   [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
B :     [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]
A[-4]:  [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]
B :     [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
A[-6]:  [1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0]
B :     [1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0]
A[-2]:  [1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0]
B :     [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0]
A[-2]:  [1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0] = END

Regards,
M.H.

{do(x,v)=print("START =\t",x);for(i=1,#v,i>1&print("B :
\t",x=B(x));print("A[",v[i],"]:\t",x=A(x,v[i])))}

A(x,b)={ b<0 & b=#x+1+b; x[b]=!x[b]; x }

B(x, L=[1], S)={ for( i=2,#x, x[i]==x[i-1] & L[#L]++ & next;
L=concat(L,1)); S=Set(L); x=!x[1];
concat( vector( #L, i, x=!x; vector( eval(S[#S+1-setsearch( S, L[i]
)]), j, x )))}




More information about the SeqFan mailing list