Re: Calculate Last Digits
- From: Paul Black <paul_black27@xxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 02:27:40 -0700
Hi everyone,
Does anyone have any ideas on how I can achieve this please?.
Thanks in Advance.
All the Best.
Paul
On Oct 30, 9:04 am, Paul Black <paul_blac...@xxxxxxxxxxx> wrote:
Hi Steve,
Thanks VERY much for all your time, effort and help.
One FINAL question please.
I am trying to count the total number of combinations that contain
0,1,2,3,4,5 and 6 Prime Numbers in a 649 Lotto.
I am having trouble putting the code together.
This is what I have so far, I am trying to use a Select Case
construct. I am trying to do it this way because there are other
numbers that I would like to test so all I will have to do is change
the numbers in the Select Case to those that I want. I don't know if
this is the best way to approach this, or maybe it would be better to
adapt your original code that uses "Map" for this?.
Option Explicit
Option Base 1
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As
Integer, F As Integer
Sub Prime()
Dim nVal(6) As Double
Dim n As Integer
For n = 0 To 6
nVal(n) = 0
Next n
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
If nVal = 0 Then nVal(0) = nVal(0) + 1
If nVal = 1 Then nVal(1) = nVal(1) + 1
If nVal = 2 Then nVal(2) = nVal(2) + 1
If nVal = 3 Then nVal(3) = nVal(3) + 1
If nVal = 4 Then nVal(4) = nVal(4) + 1
If nVal = 5 Then nVal(5) = nVal(5) + 1
If nVal = 6 Then nVal(6) = nVal(6) + 1
Next F
Next E
Next D
Next C
Next B
Next A
Range("A1").Select
For n = 0 To 6
ActiveCell.Offset(0, 0).Value = n
ActiveCell.Offset(0, 1).Value = Format(nVal(n), "#,0")
ActiveCell.Offset(1, 0).Select
Next n
End Sub
Private Function nVal() As Integer
Select Case A
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
nVal = nVal + 1
End Select
Select Case B
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
nVal = nVal + 1
End Select
Select Case C
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
nVal = nVal + 1
End Select
Select Case D
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
nVal = nVal + 1
End Select
Select Case E
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
nVal = nVal + 1
End Select
Select Case F
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47
nVal = nVal + 1
End Select
End Function
Any help will be greatly appreciated.
Thanks in Advance.
All the Best.
Paul
On Oct 26, 1:12 am, "Steve Gerrard" <mynameh...@xxxxxxxxxxx> wrote:
"Paul Black" <paul_blac...@xxxxxxxxxxx> wrote in message
news:1193330006.710719.205920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi Steve,
Unfortunately I don't quite following what you are aying.
What are the possible values of RootOfSum? Probably 0-9. Maybe higher, I don't
know. If it is the sum of digits, it could be 0-13 (49 -> 4+9 = 13). If 0 is not
possible, it could be 1 - 9.
Whatever that is, that should be the dims of Cnt(), and that should be what the
For loop goes through.- Hide quoted text -
- Show quoted text -
.
- Follow-Ups:
- Re: Calculate Last Digits
- From: Larry Serflaten
- Re: Calculate Last Digits
- References:
- Re: Calculate Last Digits
- From: Steve Gerrard
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Steve Gerrard
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Larry Serflaten
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Steve Gerrard
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Steve Gerrard
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Steve Gerrard
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- From: Steve Gerrard
- Re: Calculate Last Digits
- From: Paul Black
- Re: Calculate Last Digits
- Prev by Date: Re: How reliable is a GUID?
- Next by Date: Re: VB6 Form events/messages
- Previous by thread: Re: Calculate Last Digits
- Next by thread: Re: Calculate Last Digits
- Index(es):
Relevant Pages
|