Permutations

Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
So been a while since I've done anything like this. Say you have a 2 * 2 matrix where it's indices values can be 1 or 0. How many unique permutations are there?

Eg.

Code:
11
11

10
11

I started by drawing them out and got to about 13 or 14 then stopped to think if there was some formula which could work it out?
 
Not given this a great deal of thought, but isn't this just straight forward binary?

Flatten the grid into a binary value with the same number of columns as there are cell values and you should have the same thing.

1 = 1
11 = 3
1111 = 15
111111 = 63

and add 1 to account for the zero state
 
number of options multiplied by number of options and so on for as many positions you wish to calculate.

OP example is 2 x 2 = 4

00
11
10
01
 
256 would be 11111111 in binary (allowing for the zero case) which would be a 2 x 4 grid.

We may be at crossed purposes. If you read the open post only two values are allowed (0 and 1).
 
It's literally:

(Number of possible values the slot can have)^(number of slots)

0 and 1 gives you 2 options. 2^4 for a 2x2 grid allows 16 variants.

If it were, say, a password that could be lowercase a-z, uppercase A-Z plus digits 0-9,

26 + 26 + 10 = 62 possible values.

For a 4-character password, 62^4 = 14,776,336 possible passwords. Brute force cracker will get through that in no time.

Am I helping or making it worse :D
 
Back
Top Bottom