I couldn't think of any analytic ways: All are divisible by 9, but only some are divisible by 2, 5 or 11. It's especially tricky if ruling out leading zeros. So falling back on the computer:
10 V$="0123456789":H$=V$
15 repeat
20 gosub *Permute(&V$)
30 if left(V$,1)>"0" then
40 :inc OCt
50 :if val(V$) @ 990=0 then inc HCt
735 until V$=H$
740 print HCt,OCt,HCt/OCt,HCt//OCt
750 end
finds those cases where there is no leading zero. The results are:
31680 3265920 0.0097001763668430334 11//1134
showing the probability as 31680/3265920 11/1134 ~= 0.97 %, or 1/103.090909090909090909.
The 3265920 is 10! - 9!, representing all cases, including leading zeroes, minus the cases with leading zeroes.
However, if leading zeros are allowed, then the following program takes into consideration all 10! = 3,628,800 cases:
10 V$="0123456789":H$=V$
15 repeat
20 gosub *Permute(&V$)
30 if left(V$,1)>" " then
40 :inc OCt
50 :if val(V$) @ 990=0 then inc HCt
735 until V$=H$
740 print HCt,OCt,HCt/OCt,HCt//OCt
750 end
finds
31680 3628800 0.0087301587301587301 11//1260
That's 11/1260 ~= 1/114.5454545454545454545.
|
Posted by Charlie
on 2010-12-26 19:45:19 |