Subject: RE: [MI400] odd sort of bit-counter... From: "Joe Pluta" Date: Mon, 20 Sep 2004 15:02:43 -0500 List-archive: List-help: List-id: MI Programming on the AS400 / iSeries List-post: List-subscribe: , List-unsubscribe: ,

```> From: Dan Bale
>
>
> BTW, 100! = 9.3 e+153 = the number of any possible combination of a
list
> of 100 elements.  Were you thinking of a different value?

Factorials are permutations.  Combinations are "far smaller", relatively
speaking.  The number of possible combinations of N elements is 2^N, or
in the case of 100 elements, about a million possibilities.

The bit shifting is simply a matter of using my technique (although my
technique the bits are in "reverse" order, that is lowest to highest).
Programmatically:

For x = 1 to ArraySize
If (Array2(x) = 0)
Array2(x) = 1
Leave
Endif
Array2(x) = 0
Endfor

This is your basic binary adder.  Nothing to it.  Basically, if a bit is
zero, set it to one and get out.  Otherwise, it's one.  In binary, 1+1=0
and carry the one, so set the bit to zero and go on to the next bit.

Joe

Joe

```

As an Amazon Associate we earn from qualifying purchases.