Gavin buys a lottery ticket, and in accordance with the rules he picks six different integers from through 1 to 46 inclusively. He chooses his numbers so that the sum of the base-ten logarithms of his six numbers is an integer.
By coincidence, the integers on the winning ticket have the same property - that is: the sum of the base-ten logarithms of the six numbers is an integer.
What is the probability that Gavin holds the winning ticket?
There are 12 numbers that are either powers of 2, of 5 or a combination thereof between 1 and 45: 1, 2, 4, 8, 16, 32, 5, 25, 10, 20, 40, 50.
They can be multiplied in various combinations of six to produce a power of 10, and the following program finds these ways:
DefDbl A-Z
Dim crlf$, num(12)
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
num(1) = 1
num(2) = 2
num(3) = 4
num(4) = 8
num(5) = 16
num(6) = 32
num(7) = 5
num(8) = 25
num(9) = 10
num(10) = 20
num(11) = 40
num(12) = 50
For a = 1 To 7
For b = a + 1 To 8
For c = b + 1 To 9
For d = c + 1 To 10
For e = d + 1 To 11
For f = e + 1 To 12
prod = num(a) * num(b) * num(c) * num(d) * num(e) * num(f)
If prod = 10 Or prod = 100 Or prod = 1000 Or prod = 10000 Or prod = 100000 Or prod = 1000000 Or prod = 10000000 Or prod = 100000000 Then
Text1.Text = Text1.Text & Str(num(a)) & Str(num(b)) & Str(num(c)) & Str(num(d)) & Str(num(e)) & Str(num(f))
Text1.Text = Text1.Text & " " & prod & crlf
ct = ct + 1
End If
Next
Next
Next
Next
Next
Next
Text1.Text = Text1.Text & crlf & Str(ct) & " done"
End Sub
numbers product
1 2 4 5 25 10 10000
1 2 4 25 10 50 100000
1 2 8 5 25 50 100000
1 2 5 25 10 40 100000
1 2 5 10 20 50 100000
1 2 25 10 40 50 1000000
1 4 5 25 10 20 100000
1 4 5 25 40 50 1000000
1 4 25 10 20 50 1000000
1 8 5 25 20 50 1000000
1 16 5 25 10 50 1000000
1 5 25 10 20 40 1000000
1 25 10 20 40 50 10000000
2 4 5 25 20 50 1000000
2 8 5 25 10 50 1000000
2 5 25 20 40 50 10000000
4 5 25 10 40 50 10000000
8 5 25 10 20 50 10000000
There are 18 ways, so Gavin's probability of a win is 1/18.
|
Posted by Charlie
on 2014-10-06 14:19:08 |