Even / Odd distribution
PAB, what do you mean by:
PAB said:
I have produced the following results using my program which differ slightly with yours ...
Is it the program itself or more likely the resullts? I found your results identical to mine but you have to remember that I use a zero (0) to identify an even number and a one (1) for an odd number while you use the letters O and E for Odd and Even.
My macro (not very elegant but it works) is:
Option Explicit
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim nVal As Double, nSum(64) As Double, I As Integer
Sub Test()
nVal = 0
For I = 1 To 64
nSum(I) = 0
Next I
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
vNb = vNb + 1
Select Case A
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
nVal = 100000
End Select
Select Case B
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
nVal = nVal + 10000
End Select
Select Case C
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
nVal = nVal + 1000
End Select
Select Case D
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
nVal = nVal + 100
End Select
Select Case E
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
nVal = nVal + 10
End Select
Select Case F
Case 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49
nVal = nVal + 1
End Select
If nVal = 0 Then nSum(1) = nSum(1) + 1
If nVal = 1 Then nSum(2) = nSum(2) + 1
If nVal = 10 Then nSum(3) = nSum(3) + 1
If nVal = 11 Then nSum(4) = nSum(4) + 1
If nVal = 100 Then nSum(5) = nSum(5) + 1
If nVal = 101 Then nSum(6) = nSum(6) + 1
If nVal = 110 Then nSum(7) = nSum(7) + 1
If nVal = 111 Then nSum(8) = nSum(8) + 1
If nVal = 1000 Then nSum(9) = nSum(9) + 1
If nVal = 1001 Then nSum(10) = nSum(10) + 1
If nVal = 1010 Then nSum(11) = nSum(11) + 1
If nVal = 1011 Then nSum(12) = nSum(12) + 1
If nVal = 1100 Then nSum(13) = nSum(13) + 1
If nVal = 1101 Then nSum(14) = nSum(14) + 1
If nVal = 1110 Then nSum(15) = nSum(15) + 1
If nVal = 1111 Then nSum(16) = nSum(16) + 1
If nVal = 10000 Then nSum(17) = nSum(17) + 1
If nVal = 10001 Then nSum(18) = nSum(18) + 1
If nVal = 10010 Then nSum(19) = nSum(19) + 1
If nVal = 10011 Then nSum(20) = nSum(20) + 1
If nVal = 10100 Then nSum(21) = nSum(21) + 1
If nVal = 10101 Then nSum(22) = nSum(22) + 1
If nVal = 10110 Then nSum(23) = nSum(23) + 1
If nVal = 10111 Then nSum(24) = nSum(24) + 1
If nVal = 11000 Then nSum(25) = nSum(25) + 1
If nVal = 11001 Then nSum(26) = nSum(26) + 1
If nVal = 11010 Then nSum(27) = nSum(27) + 1
If nVal = 11011 Then nSum(28) = nSum(28) + 1
If nVal = 11100 Then nSum(29) = nSum(29) + 1
If nVal = 11101 Then nSum(30) = nSum(30) + 1
If nVal = 11110 Then nSum(31) = nSum(31) + 1
If nVal = 11111 Then nSum(32) = nSum(32) + 1
If nVal = 100000 Then nSum(33) = nSum(33) + 1
If nVal = 100001 Then nSum(34) = nSum(34) + 1
If nVal = 100010 Then nSum(35) = nSum(35) + 1
If nVal = 100011 Then nSum(36) = nSum(36) + 1
If nVal = 100100 Then nSum(37) = nSum(37) + 1
If nVal = 100101 Then nSum(38) = nSum(38) + 1
If nVal = 100110 Then nSum(39) = nSum(39) + 1
If nVal = 100111 Then nSum(40) = nSum(40) + 1
If nVal = 101000 Then nSum(41) = nSum(41) + 1
If nVal = 101001 Then nSum(42) = nSum(42) + 1
If nVal = 101010 Then nSum(43) = nSum(43) + 1
If nVal = 101011 Then nSum(44) = nSum(44) + 1
If nVal = 101100 Then nSum(45) = nSum(45) + 1
If nVal = 101101 Then nSum(46) = nSum(46) + 1
If nVal = 101110 Then nSum(47) = nSum(47) + 1
If nVal = 101111 Then nSum(48) = nSum(48) + 1
If nVal = 110000 Then nSum(49) = nSum(49) + 1
If nVal = 110001 Then nSum(50) = nSum(50) + 1
If nVal = 110010 Then nSum(51) = nSum(51) + 1
If nVal = 110011 Then nSum(52) = nSum(52) + 1
If nVal = 110100 Then nSum(53) = nSum(53) + 1
If nVal = 110101 Then nSum(54) = nSum(54) + 1
If nVal = 110110 Then nSum(55) = nSum(55) + 1
If nVal = 110111 Then nSum(56) = nSum(56) + 1
If nVal = 111000 Then nSum(57) = nSum(57) + 1
If nVal = 111001 Then nSum(58) = nSum(58) + 1
If nVal = 111010 Then nSum(59) = nSum(59) + 1
If nVal = 111011 Then nSum(60) = nSum(60) + 1
If nVal = 111100 Then nSum(61) = nSum(61) + 1
If nVal = 111101 Then nSum(62) = nSum(62) + 1
If nVal = 111110 Then nSum(63) = nSum(63) + 1
If nVal = 111111 Then nSum(64) = nSum(64) + 1
nVal = 0
Next F
Next E
Next D
Next C
Next B
Next A
Range("A1").Select
For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I
End Sub
In the sheet where you want the reults to appear, enter the values 0 to 65 in cells A2 to A65. In cell B2, enter the formula =DEC2BIN(A2;6) and copy it down. This will give you 000000 to 111111, representing the various distributions of even numbers (0) and odd numbers (1).