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

Home > Probability
Distinct Digit Determination (Posted on 2010-10-31) Difficulty: 3 of 5
M is an 8-digit base ten positive integer of the form abcdefgh, where each of the small letters represent a different digit from 1 to 9, and N is a base ten positive real number, such that M hectares is equal to N international acres.

For a value of M drawn at random between 12345678 (base ten) and 98765432 (base ten) inclusively, determine the probability that [N] contains precisely two distinct digits.

Bonus Question:

What is the answer to the original question, if M hectares is equal to N United States survey acres?

Notes:

(i) 1 international acre is equal to 0.40468564224 hectare.

(ii) 1 United States survey acre is equal to 0.404687261 hectare.

(iii)[N] denotes the greatest integer ≤ N, and [N] cannot contain any leading zero.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2

For the "international" version:

DEFDBL A-Z
FOR a = 1 TO 9
 used(a) = 1
m1 = 10000000 * a
FOR b = 1 TO 9
  IF used(b) = 0 THEN
    used(b) = 1
m2 = m1 + 1000000 * b
FOR c = 1 TO 9
  IF used(c) = 0 THEN
    used(c) = 1
m3 = m2 + 100000 * c
FOR d = 1 TO 9
  IF used(d) = 0 THEN
    used(d) = 1
m4 = m3 + 10000 * d
FOR e = 1 TO 9
  IF used(e) = 0 THEN
    used(e) = 1
m5 = m4 + 1000 * e
FOR f = 1 TO 9
  IF used(f) = 0 THEN
    used(f) = 1
m6 = m5 + 100 * f
FOR g = 1 TO 9
  IF used(g) = 0 THEN
    used(g) = 1
m7 = m6 + 10 * g
FOR h = 1 TO 9
  IF used(h) = 0 THEN
    used(h) = 1
m8 = m7 + h

permCt = permCt + 1
n = m8 / .40468564224#
trunc = INT(n)
round = INT(n + .5)
IF ABS(round - n) < .000000001# THEN PRINT "warning--close:"; m8, n
REDIM dused(9): usedCt = 0
ns$ = LTRIM$(STR$(trunc))
FOR i = 1 TO LEN(ns$)
   dig = VAL(MID$(ns$, i, 1))
   IF dused(dig) = 0 THEN usedCt = usedCt + 1
   IF usedCt > 2 THEN EXIT FOR
   dused(dig) = 1
NEXT i
IF usedCt = 2 THEN hitCt = hitCt + 1: PRINT m8, n

    used(h) = 0
  END IF
NEXT
    used(g) = 0
  END IF
NEXT
    used(f) = 0
  END IF
NEXT
    used(e) = 0
  END IF
NEXT
    used(d) = 0
  END IF
NEXT
    used(c) = 0
  END IF
NEXT
    used(b) = 0
  END IF
NEXT
 used(a) = 0
NEXT

PRINT USING "#### ######### #.################"; hitCt; permCt; hitCt / permCt
PRINT permCt / hitCt

finds

     M                 N
 13489526      33333344.68041245
 13489562      33333433.63834978
 13489726      33333838.89117539
 13578642      33553555.11216073
 15287946      37777337.28179425
 17852469      44114411.62375744
 17985624      44443444.79445004
 17986253      44444999.08729947
 18394765      45454454.22323862
 18435679      45555554.91901209
 24935176      61616161.77430906
 24935178      61616166.71641669
 26573948      65665655.57628616
 26938574      66566666.04451463
 27869351      68866666.10097326
 29431685      72727277.49146448
 29431865      72727722.28115113
 29431867      72727727.22325876
 35971648      88887878.01042596
 36425718      90009909.41605392
 45189672      111666111.3793608
 45289176      111911991.1181359
 47829315      118188811.2838821
 53147896      131331311.1525723
 
 and the following statistics:
 
  24    362880 0.0000661375661376
 15120
 


indicating there were 24 values of M for which [N] used two distinct digits. This was out of P(9,8) = 362,880 valid values of M, making the probability ~= 0.0000661375661376, or 0.00661375661376 %, or 1/15,120.

Substituting the US survey acre value, we get:

     M                 N
 13489562      33333300.3037128
 13489576      33333334.89832782
 13489657      33333535.05288618
 13894267      34333344.13756108
 13894672      34334344.91035289
 14826379      36636633.83760429
 17536489      43333434.70379217
 17986234      44444774.35626519
 17986325      44444999.22126286
 19768345      48848448.92609555
 19768523      48848888.77191516
 25198347      62266222.41019838
 26815479      66262226.623437
 26897314      66464444.50348043
 26897315      66464446.97452436
 26958714      66616166.60080634
 28614537      70707777.97475567
 31467582      77757777.50513376
 35612479      88000000.0790734
 35749621      88338883.98577487
 35927681      88778878.06802003
 35976248      88898889.25858726
 36458279      90090009.03539684
 37198526      91919191.89173587
 45128763      111515155.8971361
 45169823      111616616.9609179
 45783619      113133333.8412152
 53148927      131333333.4700644
 57239416      141441111.4858394
 62789315      155155155.7240642
 62935148      155515515.4735647
 89521764      221212211.5699609
 92156487      227722727.8473685
 


 so this time 33 hits out of the 362880 valid permutations, for a probability of 0.0000909391534392 or 0.00909391534392 % or 1/10996.3636363636....

Recognizing that my definition of a close call might be deficient, I rewrote the program for UBASIC, giving increased accuracy and found only two instances of close calls as to whether N was slightly above or below an integer, and in neither case could the digits in the integer part be merely two distinct ones :

 13489526        33333344.6804124503097782782
 13489562        33333433.6383497784893014988
 13489726        33333838.8911753846404628371
 13578642        33553555.1121607293762040518
warning--close: 14275698         35276018.0000004934244836435
 15287946        37777337.2817942452584007465
warning--close: 17289653         42723662.9999991966163828837
 17852469        44114411.6237574379091865131
 17985624        44443444.7944500419206987432
 17986253        44444999.0872994703907016811
 18394765        45454454.223238616873754395
 18435679        45555554.9190120929018946179
 24935176        61616161.7743090603083885888
 24935178        61616166.7164166896516954344
 26573948        65665655.5762861551313687268
 26938574        66566666.044514621432308672
 27869351        68866666.1009732589902172668
 29431685        72727277.4914644819688658225
 29431865        72727722.2811511228664819256
 29431867        72727727.2232587522097887711
 35971648        88887878.0104259525027666043
 36425718        90009909.4160539101724549998
 45189672        111666111.379360805873770419
 45289176        111911991.1181358940759521841
 47829315        118188811.2838821331296765244
 53147896        131331311.1525723102627374537
 24  362880  0.0000661375661375661
 15120.0
from
  100   dim Used(9)
  110   for A=1 to 9
  120   Used(A)=1
  130   M1=10000000*A
  140   for B=1 to 9
  150    if Used(B)=0 then
  160   :Used(B)=1
  170   :M2=M1+1000000*B
  180   :for C=1 to 9
  190   :if Used(C)=0 then
  200   :Used(C)=1
  210   :M3=M2+100000*C
  220   :for D=1 to 9
  230   :if Used(D)=0 then
  240   :Used(D)=1
  250   :M4=M3+10000*D
  260   :for E=1 to 9
  270   :if Used(E)=0 then
  280   :Used(E)=1
  290   :M5=M4+1000*E
  300   :for F=1 to 9
  310   :if Used(F)=0 then
  320   :Used(F)=1
  330   :M6=M5+100*F
  340   :for G=1 to 9
  350   :if Used(G)=0 then
  360   :Used(G)=1
  370   :M7=M6+10*G
  380   :for H=1 to 9
  390   :if Used(H)=0 then
  400   :Used(H)=1
  410   :M8=M7+H
  420   :
  430   :PermCt=PermCt+1
  440   :N=M8/0.40468564224
  450   :Trunc=int(N)
  460   :Round=int(N+0.5)
  470   :if abs(Round-N)<0.000001 then print "warning--close:";M8,N:endif
  480   :dim Dused(9):UsedCt=0
  490   :Ns$=cutspc(str(Trunc))
  500   :for I=1 to len(Ns$)
  510   :Dig=val(mid(Ns$,I,1))
  520   :if Dused(Dig)=0 then UsedCt=UsedCt+1:endif
  540   :Dused(Dig)=1
  550   :next I
  560   :if UsedCt=2 then HitCt=HitCt+1:print M8,N:endif
  570   :erase Dused()
  580   :Used(H)=0
  590   :endif
  600   :next H
  610   :Used(G)=0
  620   :endif
  630   :next G
  640   :Used(F)=0
  650   :endif
  660   :next F
  670   :Used(E)=0
  680   :endif
  690   :next E
  700   :Used(D)=0
  710   :endif
  720   :next D
  730   :Used(C)=0
  740   :endif
  750   :next C
  760   :Used(B)=0
  770   :endif
  780   :next B
  790   :Used(A)=0
  800   :next A
  810
  820   print HitCt;PermCt;HitCt/PermCt
  830   print PermCt/HitCt
 
 

  Posted by Charlie on 2010-10-31 14:25:51
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 (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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