Determine the probability that a for a seven-digit positive hexadecimal integer N, the sum of the first four digits of N is equal to the product of the last three digits of N.
(In reply to
re(2): computer solution by Charlie)
I decided to code the basic program to reduce the semi-manual calculations I had done. Either I had made a small error while using Excel, or, as you had supposed, the number of significant digits may have been the problem. Nonetheless, the program "spit out" the same answer (basically) you had computed:
0.20524025e-2
The program only took about a second to run.
dim s(60)
dim p(60)
for a = 0 to 15
for b = 0 to 15
for c = 0 to 15
p = a * b * c
if p > 0 and p < 61 then
p(p) = p(p) + 1
end if
for d = 1 to 15
s = a+b+c+d
s(s) = s(s) + 1
next d
next c
next b
next a
prob = 0
for i = 1 to 60
prob = prob + (s(i)/4096)*(p(i)/61440)
next i
print str$(prob)
|
Posted by Dej Mar
on 2014-12-25 19:16:17 |