re a question from Maple users

Edwin Clark eclark at math.usf.edu
Mon May 15 07:08:33 CEST 2006


On Mon, 15 May 2006, N. J. A. Sloane wrote:

> Emeric,  say you want all 16 binary vectors of length 4
> 
> This will get them all, but with an extra 1 at the end which you
> will have to ignore - or delete with an editor:
> 
> > for i from 0 to 2^4-1 do lprint(convert(2^4+i,base,2)); od:


The following will get rid of the final 1 for you:

> n:=4:
> for i from 0 to 2^n-1 do convert(2^n+i,base,2)[1..n]; od; 

And if you want to put them in a set you can do this:

> S:={seq(convert(2^n+i,base,2)[1..n],i=0..2^n-1)};






More information about the SeqFan mailing list