Count Specific Total Numbers from a Set
Instead of Select Case, and looping 49 times, I suppose we could loop 15
times.
As you can see, there are many different ideas one can use.
The idea here is that the Array is initialized with zero anyway, and we are
just setting a few of them to 1.
Dim P As Variant
' Do Once Here
For Each P In Array(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47)
n(P) = 1&
Next P
I'm not sure of your second question, as I se eyou already have a solution
to your Odd/Even query.
--
Dana DeLouis
"Paul Black" wrote in message
oups.com...
I would like to do two more tests, mainly count the number of Odd &
Even numbers, but that involves two scenarios, one for Odd & the other
for Even. The results should be as follows :-
0 Odd + 6 Even = 134,596
1 Odd + 5 Even = 1,062,600
2 Odd + 4 Even = 3,187,800
3 Odd + 3 Even = 4,655,200
4 Odd + 2 Even = 3,491,400
5 Odd + 1 Even = 1,275,120
6 Odd + 0 Even = 177,100
Totals = 1,3983,816
' Do Once Here
For R = 1 To 49
Select Case R
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
n(R) = 1
Case Else
n(R) = 0
End Select
Next R
|