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

Home > Probability
Even (related) chances (Posted on 2017-08-09) Difficulty: 3 of 5
Consider a string of n quaternary digits, randomly created.

Evaluate the probability that in this string the quantity
of an a priori defined digit, say zero, is even.

Double check your result by
either
a. direct count and comparison (e.g. n=4)
or
b. getting the same result by two distinct methods.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution (spoiler) | Comment 1 of 4
Sigma{i=0 to floor(n/2)} (1/4)^(2i) * (3/4)^(n-2i) * C(n,2i)

 n  probability
 1 .75
 2 .625
 3 .5625
 4 .53125
 5 .515625
 6 .5078125
 7 .50390625
 8 .501953125
 9 .5009765625
10 .50048828125
11 .500244140625
12 .5001220703125
13 .50006103515625
14 .500030517578125
15 .500015258789063
16 .500007629394531
17 .500003814697266
18 .500001907348633
19 .500000953674316
20 .500000476837158
21 .500000238418579
22 .50000011920929
23 .500000059604645
24 .500000029802322
25 .500000014901161

from

Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 For n = 1 To 25
   p = 0
   For i = 0 To n / 2
     p = p + (1 / 4) ^ (2 * i) * (3 / 4) ^ (n - 2 * i) * combi(n, 2 * i)
   Next i
   Text1.Text = Text1.Text & n & Str(p) & crlf
 Next
 
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Function combi(n, r)
  c = 1
  For i = n To n - r + 1 Step -1
    c = c * i
  Next
  For i = 2 To r
    c = c / i
  Next
  combi = c
End Function

Double check via choice a:

direct count of even number of zeros (evens marked with *):

0000   4 *
0001   3
0002   3
0003   3
0010   3
0011   2 *
0012   2 *
0013   2 *
0020   3
0021   2 *
0022   2 *
0023   2 *
0030   3
0031   2 *
0032   2 *
0033   2 *
0100   3
0101   2 *
0102   2 *
0103   2 *
0110   2 *
0111   1
0112   1
0113   1
0120   2 *
0121   1
0122   1
0123   1
0130   2 *
0131   1
0132   1
0133   1
0200   3
0201   2 *
0202   2 *
0203   2 *
0210   2 *
0211   1
0212   1
0213   1
0220   2 *
0221   1
0222   1
0223   1
0230   2 *
0231   1
0232   1
0233   1
0300   3
0301   2 *
0302   2 *
0303   2 *
0310   2 *
0311   1
0312   1
0313   1
0320   2 *
0321   1
0322   1
0323   1
0330   2 *
0331   1
0332   1
0333   1
1000   3
1001   2 *
1002   2 *
1003   2 *
1010   2 *
1011   1
1012   1
1013   1
1020   2 *
1021   1
1022   1
1023   1
1030   2 *
1031   1
1032   1
1033   1
1100   2 *
1101   1
1102   1
1103   1
1110   1
1111   0 *
1112   0 *
1113   0 *
1120   1
1121   0 *
1122   0 *
1123   0 *
1130   1
1131   0 *
1132   0 *
1133   0 *
1200   2 *
1201   1
1202   1
1203   1
1210   1
1211   0 *
1212   0 *
1213   0 *
1220   1
1221   0 *
1222   0 *
1223   0 *
1230   1
1231   0 *
1232   0 *
1233   0 *
1300   2 *
1301   1
1302   1
1303   1
1310   1
1311   0 *
1312   0 *
1313   0 *
1320   1
1321   0 *
1322   0 *
1323   0 *
1330   1
1331   0 *
1332   0 *
1333   0 *
2000   3
2001   2 *
2002   2 *
2003   2 *
2010   2 *
2011   1
2012   1
2013   1
2020   2 *
2021   1
2022   1
2023   1
2030   2 *
2031   1
2032   1
2033   1
2100   2 *
2101   1
2102   1
2103   1
2110   1
2111   0 *
2112   0 *
2113   0 *
2120   1
2121   0 *
2122   0 *
2123   0 *
2130   1
2131   0 *
2132   0 *
2133   0 *
2200   2 *
2201   1
2202   1
2203   1
2210   1
2211   0 *
2212   0 *
2213   0 *
2220   1
2221   0 *
2222   0 *
2223   0 *
2230   1
2231   0 *
2232   0 *
2233   0 *
2300   2 *
2301   1
2302   1
2303   1
2310   1
2311   0 *
2312   0 *
2313   0 *
2320   1
2321   0 *
2322   0 *
2323   0 *
2330   1
2331   0 *
2332   0 *
2333   0 *
3000   3
3001   2 *
3002   2 *
3003   2 *
3010   2 *
3011   1
3012   1
3013   1
3020   2 *
3021   1
3022   1
3023   1
3030   2 *
3031   1
3032   1
3033   1
3100   2 *
3101   1
3102   1
3103   1
3110   1
3111   0 *
3112   0 *
3113   0 *
3120   1
3121   0 *
3122   0 *
3123   0 *
3130   1
3131   0 *
3132   0 *
3133   0 *
3200   2 *
3201   1
3202   1
3203   1
3210   1
3211   0 *
3212   0 *
3213   0 *
3220   1
3221   0 *
3222   0 *
3223   0 *
3230   1
3231   0 *
3232   0 *
3233   0 *
3300   2 *
3301   1
3302   1
3303   1
3310   1
3311   0 *
3312   0 *
3313   0 *
3320   1
3321   0 *
3322   0 *
3323   0 *
3330   1
3331   0 *
3332   0 *
3333   0 *

asterisked lines show an even number of zeros

136 out of 256 = .53125

from

 For a = 0 To 3
 For b = 0 To 3
 For c = 0 To 3
 For d = 0 To 3
    Text1.Text = Text1.Text & a & b & c & d & "   "
    subct = 0
    If a = 0 Then subct = subct + 1
    If b = 0 Then subct = subct + 1
    If c = 0 Then subct = subct + 1
    If d = 0 Then subct = subct + 1
    Text1.Text = Text1.Text & subct
    If subct Mod 2 = 0 Then Text1.Text = Text1.Text & " *": ct = ct + 1
    Text1.Text = Text1.Text & crlf
 Next
 Next
 Next
 Next


  Posted by Charlie on 2017-08-09 11:34:37
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 (5)
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