All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Hexadecimal Digit Travail (Posted on 2014-12-25) Difficulty: 3 of 5
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.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 5
516504/251658240 = 21521/10485760 ~= 0.002052402
 
from

 pr$ = Chr$(1)
 For v = fromBase("1000000", 16) To fromBase("fffffff", 16)
   overct = overct + 1
   h$ = base$(v, 16)
   tot = 0: prod = 1
   For i = 1 To 4
    tot = tot + fromBase(Mid(h$, i, 1), 16)
   Next
   For i = 5 To 7
    prod = prod * fromBase(Mid(h$, i, 1), 16)
   Next
   If tot = prod Then
     ct = ct + 1
'     Text1.Text = Text1.Text & h$ & crlf
'     DoEvents
   End If
    If Left(h$, 1) <> pr$ Then Text1.Text = Text1.Text & h$ & crlf: DoEvents
    pr$ = Left(h$, 1)
 Next v
 g = gcd(ct, overct)
 
 Text1.Text = Text1.Text & crlf & ct & Str(overct) & Str(ct / g) & Str(overct / g) & mform(ct / overct, "##0.000000000") & crlf: DoEvents

The output included the hex value every time the first digit changed, as the whole process took over 1/2 hour run time, I needed a progress indication:

1000000
2000000
3000000
4000000
5000000
6000000
7000000
8000000
9000000
a000000
b000000
c000000
d000000
e000000
f000000

516504 251658240 21521 10485760  0.002052402
 done

  Posted by Charlie on 2014-12-25 14:01:32
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information