•

Check out our Community Blogs Register and join over 40,000 other developers!

### Popular Tags      # Creating a special 4 column matrix with 65536 unique combinations

matrix

3 replies to this topic

### #1 UniBoy

UniBoy

Posted 12 May 2010 - 05:50 AM

Hi there,
I would like to create a for-loop or even a nested type of for-loops (with if statements, when necessary) similar to the following which I’ve written in VB6

```[FONT=Arial][SIZE=2]Dim myAscii As String[/SIZE][/FONT]
[FONT=Arial][SIZE=2]myAscii = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#\$%^&*()-=_+[]{}\|;:'" & Chr(34) & "/?.>,< "[/SIZE][/FONT]

[FONT=Arial][SIZE=2]Dim a, b, c, d, i, j, k As Integer[/SIZE][/FONT]
[FONT=Arial][SIZE=2]Dim state(0 To 9) As Integer 'state, indicates the column turn for a next recursion, incrementally up to no. 16 for each loop[/SIZE][/FONT]

[FONT=Arial][SIZE=2]a = 1[/SIZE][/FONT]
[FONT=Arial][SIZE=2]b = 1[/SIZE][/FONT]
[FONT=Arial][SIZE=2]c = 1[/SIZE][/FONT]
[FONT=Arial][SIZE=2]d = 1[/SIZE][/FONT]

[FONT=Arial][SIZE=2]Open "c:\GC.txt" For Output As #1[/SIZE][/FONT]

[FONT=Arial][SIZE=2]For i = 0 To 65535[/SIZE][/FONT]
[FONT=Arial][SIZE=2]Print #1, a + i & " | " & a & "x" & b + k & "x" & c & "x" & d & " | " & myAscii & "|" & "cc"[/SIZE][/FONT]
[FONT=Arial][SIZE=2]state(0) = 1[/SIZE][/FONT]
[FONT=Arial][SIZE=2]Next i[/SIZE][/FONT]

```

This is the file I need to read from in aim of reconstructing characters for an output string, based on a certain matrix combination i.e. the first four columns denoting the char address(es).

But I’m aiming for implementing the recursive counts for each column of the generated matrix similar or exact to the following (just the first four columns or the addresses)

1x1x1x1
1x2x1x1
1x3x1x1

1x16x1x1
1x1x2x1
1x1x2x2
1x1x2x3

1x1x2x16
1x1x1x2
1x1x2x2

1x1x16x2
1x2x2x1
1x2x3x1

1x2x16x1
1x2x2x1
1x2x2x2

1x2x2x16
1x and so on
2x1x1x1
with similar configuration

3x1x1x1

16x1x1x1
with similar configuration
...
16x16x16x16

Where the maximum limit of the count is 16 for each fulfilled combinations column. The total number of unique combinations is 65536 rows.

Any help on this for constructing the matrix I would appreciate,
please give me tips, algorithmic formulation or a code to implement this • 0

### #2 UniBoy

UniBoy

Posted 12 May 2010 - 05:55 AM

One other thing I need to add is, the number "65536" mathematically comes from the number of possible combinations i.e. 16^4, where 4 is the total number of columns, and 16 is the total number of rows limit satisfying possible combinations • 0

### #3 bytelogik

bytelogik

Posted 15 May 2010 - 01:18 AM

UniBoy,

"Creating a special 4 column matrix with 65536 unique combinations"

4 * 4 means 16 values from 65536 unique combinations ?
Do you want to generate 65536 / 16 = 4096 matrices ?

Can you please be more specific regarding the ouput ?

Good Luck.
• 0

### #4 UniBoy

UniBoy

Posted 15 May 2010 - 03:45 AM

Hi bytelogic,

I have been specific. 16^4 = 16 * 16 * 16 * 16 or, for your version, 2^ (4*4) which means 2^(16) = 65536 which is the same. 16 denotes the number of combinations limit or the numbers to play within the columns in terms of {1, 2, 3, 4, … 16},

So, when we power the number of combinations limit to the 4 "by the symbol ^" on the column, we get 65536 rows or the total number of combinations.

The number "4" is the total number of columns.

As you may refer to the example above on the matrix, this could be noticed for 65536 possible combinations. Consider the numbers to play within these columns as 1, 2, 3, 4, 5, ... 16 only. So the number of combinations for a 4-column matrix is expected to be 65536 indeed.

The expected output is 65536 unique combinations, each having a combination of the 1 to 16 range for the 4 columns given just like the example provided in my 1st post • 0

### Also tagged with one or more of these keywords: matrix

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download 