How to bet against any given, 4, -letter word in the David Litt game with a fair die with, 2, faces By Shalosh B. Ekhad ----------------------------------------------------------------- ----------------------------------------------------------------- Chapter Number, 1 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 1, 1, 1], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 1]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 34 3 2 (4 n + 51 n + 164 n + 144) a(n + 2) 16/3 ------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 4 (75 n + 1279 n + 6884 n + 11844) a(n + 3) + --------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 2 (483 n + 9431 n + 59428 n + 121828) a(n + 4) - ------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (817 n + 24924 n + 232409 n + 673710) a(n + 5) - 2/3 ------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (3887 n + 105927 n + 955960 n + 2829660) a(n + 6) + 2/3 --------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (7343 n + 202983 n + 1846060 n + 5510940) a(n + 7) - 1/3 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4055 n + 250581 n + 3545446 n + 14583120) a(n + 8) + 1/6 ----------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (11537 n + 603975 n + 8721634 n + 38403600) a(n + 9) - 1/6 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (12109 n + 445625 n + 5453630 n + 22179208) a(n + 10) + 1/2 ------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (5995 n + 162805 n + 1274180 n + 2177776) a(n + 11) - 1/2 ----------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2759 n + 83670 n + 1125721 n + 6572364) a(n + 12) + 1/3 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (19345 n + 751587 n + 10410818 n + 51206568) a(n + 13) - 1/6 -------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (39521 n + 1361697 n + 14068090 n + 37762584) a(n + 14) + 1/6 --------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (3367 n + 70834 n - 142443 n - 6618800) a(n + 15) - --------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2975 n + 436281 n + 11123722 n + 78229968) a(n + 16) - 1/6 ------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (13735 n + 697197 n + 10973054 n + 51484680) a(n + 17) - 1/6 -------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1118 n + 38313 n + 42100 n - 5230272) a(n + 18) + 2/3 -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (14267 n + 927903 n + 19842514 n + 139715520) a(n + 19) + 1/6 --------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2631 n + 138596 n + 2385021 n + 13351252) a(n + 20) - ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (14885 n + 805299 n + 14455690 n + 86469192) a(n + 21) + 1/6 -------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4261 n + 291675 n + 6633866 n + 50039184) a(n + 22) - 1/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (3937 n + 280353 n + 6506858 n + 49185036) a(n + 23) + 1/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (2003 n + 137130 n + 3106051 n + 23252124) a(n + 24) - 2/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 4 (51 n + 4648 n + 137189 n + 1319637) a(n + 25) + -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (374 n + 18570 n + 226453 n - 77358) a(n + 26) + 2/3 ------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (191 n + 11160 n + 198013 n + 973926) a(n + 27) - 2/3 ------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 2 (94 n + 7173 n + 181402 n + 1519660) a(n + 28) + -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (379 n + 28815 n + 719120 n + 5867004) a(n + 29) - 1/3 -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (3 n - 153 n - 16450 n - 274744) a(n + 30) + -------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (13 n + 1211 n + 37562 n + 387944) a(n + 32) + ---------------------------------------------- + a(n + 34) (n + 30) (n + 34) (n + 31) 2 (7 n + 445 n + 7058) a(n + 33) (2 n + 3) (n + 2) (n + 1) a(n) - ------------------------------- - 16/3 ------------------------------ (n + 34) (n + 31) (n + 30) (n + 34) (n + 31) 2 (n + 2) (2 n + 23 n + 33) a(n + 1) - 8/3 ----------------------------------- (n + 30) (n + 34) (n + 31) 2 2 (n + 32) (2 n + 113 n + 1591) a(n + 31) + ------------------------------------------ = 0 (n + 30) (n + 34) (n + 31) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 29, a(8) = 67, a(9) = 148, a(10) = 324, a(11) = 693, a(12) = 1468, a(13) = 3067, a(14) = 6372, a(15) = 13138, a(16) = 26985, a(17) = 55151, a(18) = 112401, a(19) = 228339, a(20) = 462949, a(21) = 936565, a(22) = 1891970, a(23) = 3816208, a(24) = 7689352, a(25) = 15476943, a(26) = 31127327, a(27) = 62555884, a(28) = 125644462, a(29) = 252220247, a(30) = 506092386, a(31) = 1015092415, a(32) = 2035362654, a(33) = 4079902625, a(34) = 8176228211 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 20 2 (2 n + 3) (n + 2) (n + 1) b(n) (n + 2) (14 n + 65 n + 87) b(n + 1) 16/3 ------------------------------ - 8/3 ------------------------------------ (n + 20) (n + 19) (n + 16) (n + 20) (n + 19) (n + 16) 3 2 (4 n + 9 n - 64 n - 168) b(n + 2) + 16/3 ----------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (119 n + 2055 n + 11056 n + 18972) b(n + 3) + 4/3 --------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (431 n + 7515 n + 42076 n + 76452) b(n + 4) - 2/3 --------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (401 n + 7632 n + 47701 n + 98502) b(n + 5) + 2/3 --------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (653 n + 15417 n + 121300 n + 317772) b(n + 6) - 2/3 ------------------------------------------------ (n + 20) (n + 19) (n + 16) 3 2 (553 n + 14173 n + 119736 n + 333868) b(n + 7) + ------------------------------------------------ (n + 20) (n + 19) (n + 16) 3 2 (2591 n + 69597 n + 620134 n + 1836048) b(n + 8) - 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (723 n + 23717 n + 260806 n + 959120) b(n + 9) + 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 16) 3 2 (655 n + 26775 n + 350426 n + 1486440) b(n + 10) - 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (1553 n + 69303 n + 976744 n + 4431504) b(n + 11) + 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (339 n + 16075 n + 243732 n + 1198448) b(n + 12) - 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (89 n + 5233 n + 93432 n + 526884) b(n + 13) + ---------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (403 n + 25317 n + 478562 n + 2845824) b(n + 14) - 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (85 n + 4993 n + 92794 n + 555648) b(n + 15) + 1/2 ---------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (115 n + 4617 n + 58400 n + 222816) b(n + 16) + 1/6 ----------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (33 n + 1605 n + 25876 n + 138144) b(n + 17) - 3/2 ---------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (63 n + 3209 n + 54266 n + 304472) b(n + 18) + 1/2 ---------------------------------------------- (n + 20) (n + 19) (n + 16) 2 3 (3 n + 102 n + 860) b(n + 19) - -------------------------------- + b(n + 20) = 0 (n + 20) (n + 16) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 18, b(8) = 42, b(9) = 93, b(10) = 206, b(11) = 441, b(12) = 942, b(13) = 1981, b(14) = 4159, b(15) = 8648, b(16) = 17937, b(17) = 36978, b(18) = 76075, b(19) = 155897, b(20) = 318905 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.10664 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.7464 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 61.231, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 2, 2, 2]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 3.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 26 2 (15 n + 707 n + 8292) a(n + 25) -1/2 -------------------------------- (n + 26) (n + 23) 2 (n + 3) (79 n + 648 n + 1340) a(n + 2) - 8/3 --------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 4) (65 n + 628 n + 1386) a(n + 3) - 8/3 --------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 5) (29 n + 236 n + 108) a(n + 4) - 2/3 -------------------------------------- (n + 23) (n + 22) (n + 26) 2 16 (n + 2) (7 n + 53 n + 98) a(n + 1) 32 (n + 4) (n + 2) (n + 1) a(n) - -------------------------------------- - ------------------------------- (n + 23) (n + 22) (n + 26) (n + 23) (n + 22) (n + 26) 3 2 (213 n + 4767 n + 36288 n + 91804) a(n + 5) + --------------------------------------------- + a(n + 26) (n + 23) (n + 22) (n + 26) 3 2 (817 n + 36609 n + 503048 n + 1961808) a(n + 20) - 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (179 n + 7533 n + 86686 n + 157152) a(n + 21) + 1/6 ----------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (58 n + 3453 n + 68237 n + 447690) a(n + 22) - 1/3 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (35 n + 2403 n + 54634 n + 411528) a(n + 23) - 1/6 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (26 n + 1755 n + 39406 n + 294372) a(n + 24) + 2/3 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (81 n + 601 n - 10194 n - 72944) a(n + 6) + 1/2 ------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (596 n + 24297 n + 291037 n + 1084080) a(n + 7) - 1/3 ------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (1645 n + 58343 n + 656286 n + 2383976) a(n + 8) - 1/2 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (331 n + 12714 n + 138155 n + 434718) a(n + 9) - 1/3 ------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (529 n + 42213 n + 734342 n + 3717216) a(n + 10) + 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (5591 n + 232575 n + 3158530 n + 14087568) a(n + 11) + 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (1013 n + 39041 n + 503132 n + 2175120) a(n + 12) - 1/2 --------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (585 n + 19755 n + 216738 n + 758120) a(n + 13) + 1/2 ------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (345 n + 21595 n + 404428 n + 2372924) a(n + 14) - 1/2 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (3479 n + 158445 n + 2371504 n + 11660352) a(n + 15) + 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (4733 n + 207999 n + 3010018 n + 14293800) a(n + 16) - 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (157 n + 7761 n + 128012 n + 699980) a(n + 17) + 1/2 ------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (389 n + 17601 n + 266278 n + 1354848) a(n + 18) + 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (1261 n + 59337 n + 898610 n + 4320504) a(n + 19) + 1/6 --------------------------------------------------- = 0 (n + 23) (n + 22) (n + 26) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 20, a(8) = 46, a(9) = 105, a(10) = 233, a(11) = 508, a(12) = 1095, a(13) = 2332, a(14) = 4929, a(15) = 10345, a(16) = 21585, a(17) = 44824, a(18) = 92686, a(19) = 190975, a(20) = 392272, a(21) = 803553, a(22) = 1642148, a(23) = 3348847, a(24) = 6816665, a(25) = 13852607, a(26) = 28109365 Lemma , 3.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) b(n) 6 (n + 5 n + 8) b(n + 1) - ----------------------- - ------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (n + 3) (5 n - 8) b(n + 2) (47 n + 451 n + 1092) b(n + 3) - -------------------------- + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (26 n + 261 n + 610) b(n + 4) (4 n - 3 n - 145) b(n + 5) - 1/2 ------------------------------ + 1/2 --------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (16 n + 343 n + 1632) b(n + 6) - 1/2 ------------------------------- (n + 13) (n + 9) 2 (40 n + 629 n + 2413) b(n + 7) + 1/2 ------------------------------- (n + 13) (n + 9) 2 2 (36 n + 547 n + 2054) b(n + 8) (2 n + 39 n + 219) b(n + 9) - 1/2 ------------------------------- + 1/2 ---------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (2 n + 37 n + 188) b(n + 10) (13 n + 252 n + 1163) b(n + 11) + 1/2 ----------------------------- + 1/2 -------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (5 n + 104 n + 522) b(n + 12) - ------------------------------ + b(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 2, b(6) = 5, b(7) = 12, b(8) = 27, b(9) = 62, b(10) = 136, b(11) = 296, b(12) = 638, b(13) = 1360 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.070537 1/2 - -------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 1.058 1/2 - ----- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 36.653, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 1]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 108 (n + 1) (n + 2) (n + 3) a(n) 18 (5 n - 8) (n + 3) (n + 2) a(n + 1) - -------------------------------- + ------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 9 (n + 3) (3 n - 136 n - 486) a(n + 2) - --------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (929 n + 16728 n + 97195 n + 180384) a(n + 3) + 3/2 ----------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2919 n + 61069 n + 404414 n + 859080) a(n + 4) - 3/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 3 (2503 n + 52430 n + 354549 n + 780372) a(n + 5) + --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11509 n + 196683 n + 912944 n + 716016) a(n + 6) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (6379 n + 274786 n + 3311107 n + 12129000) a(n + 7) - 1/2 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13231 n + 404682 n + 4028539 n + 13111554) a(n + 8) + ------------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (43571 n + 1340529 n + 13406095 n + 43661151) a(n + 9) - 1/3 -------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (14137 n + 473355 n + 5062871 n + 17353992) a(n + 10) + 1/3 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (31093 n + 962520 n + 9998447 n + 34970628) a(n + 11) + 1/6 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (36862 n + 1204185 n + 13159061 n + 48384168) a(n + 12) - 1/6 --------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3277 n + 112227 n + 1345416 n + 5760706) a(n + 13) + 1/2 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11153 n + 365859 n + 3603832 n + 9419928) a(n + 14) + 1/6 ------------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (13609 n + 475785 n + 5208548 n + 17116026) a(n + 15) - 1/6 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2165 n + 81975 n + 999684 n + 3889716) a(n + 16) + 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1358 n + 60405 n + 906109 n + 4615698) a(n + 17) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (9 n + 1382 n + 39477 n + 314290) a(n + 18) + 1/2 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (293 n + 15630 n + 278767 n + 1664322) a(n + 19) + 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (133 n + 7577 n + 143668 n + 906828) a(n + 20) - 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (229 n + 13380 n + 260021 n + 1681086) a(n + 21) + 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (10 n + 411 n + 4198) a(n + 22) - -------------------------------- + a(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 59, a(9) = 133, a(10) = 293, a(11) = 632, a(12) = 1340, a(13) = 2818, a(14) = 5888, a(15) = 12224, a(16) = 25228, a(17) = 51823, a(18) = 106094, a(19) = 216560, a(20) = 440879, a(21) = 895460, a(22) = 1815261, a(23) = 3673951 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 180 (n + 1) (n + 2) (n + 3) b(n) 90 (7 n + 24) (n + 3) (n + 2) b(n + 1) - -------------------------------- + -------------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 9 (n + 3) (49 n + 284 n + 262) b(n + 2) - ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (301 n + 4620 n + 23243 n + 38016) b(n + 3) - 3/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (n + 6) (301 n + 1657 n + 712) b(n + 4) + 3/2 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (5 n + 332 n + 2795 n + 5840) b(n + 5) + 9/2 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (196 n + 8592 n + 94925 n + 309540) b(n + 6) + ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (657 n + 25940 n + 277927 n + 901404) b(n + 7) - 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (10 n + 709 n - 1971 n - 62124) b(n + 8) + 1/2 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (492 n + 18831 n + 226801 n + 876098) b(n + 9) + 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (205 n + 7231 n + 82511 n + 306762) b(n + 10) - ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (32 n + 1511 n + 21647 n + 97322) b(n + 11) - 1/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (289 n + 10155 n + 117682 n + 448876) b(n + 12) + 1/2 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (168 n + 5893 n + 67995 n + 257178) b(n + 13) - 1/2 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (7 n + 472 n + 8779 n + 49522) b(n + 14) - 1/2 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (21 n + 897 n + 12698 n + 59512) b(n + 15) + -------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) b(n + 16) - ------------------------------- + b(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 7, b(7) = 16, b(8) = 37, b(9) = 85, b(10) = 186, b(11) = 400, b(12) = 852, b(13) = 1809, b(14) = 3810, b(15) = 7959, b(16) = 16538, b(17) = 34236 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.1152 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.8063 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 39.043, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 2]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 5.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 33 2 (n + 3) (65 n + 669 n + 1732) a(n + 2) -16/3 --------------------------------------- (n + 30) (n + 29) (n + 33) (n + 1) (n + 2) (n + 3) a(n) 64 (n + 4) (n + 3) (n + 2) a(n + 1) + 64/3 ---------------------------- - ----------------------------------- (n + 30) (n + 29) (n + 33) (n + 30) (n + 29) (n + 33) 2 (n + 28) (18 n + 941 n + 12001) a(n + 30) + ------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 8 (n + 278 n + 2695 n + 6426) a(n + 3) - ---------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (761 n + 11448 n + 54721 n + 81822) a(n + 4) + 4/3 ---------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (247 n + 3852 n + 15722 n + 8331) a(n + 5) + 4/3 -------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (509 n - 9330 n - 196331 n - 740592) a(n + 6) - 1/3 ----------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (9391 n + 313200 n + 3386945 n + 11842176) a(n + 7) + 1/6 ----------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2435 n + 108000 n + 1210573 n + 3906660) a(n + 8) - 1/3 ---------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (24997 n + 941640 n + 11528759 n + 45957540) a(n + 9) - 1/6 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2605 n + 91980 n + 1433717 n + 8062158) a(n + 10) - 1/3 ---------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (17071 n + 698586 n + 9309011 n + 40493064) a(n + 11) + 1/3 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (11120 n + 572733 n + 9495061 n + 50948760) a(n + 12) + 1/3 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (37795 n + 1580868 n + 21677873 n + 97399968) a(n + 13) - 1/6 --------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (5798 n + 340512 n + 6251734 n + 36722019) a(n + 14) - 2/3 ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (11355 n + 497904 n + 7225953 n + 34720196) a(n + 15) + 1/2 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (28177 n + 1443462 n + 24234953 n + 133528728) a(n + 16) + 1/6 ---------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (12379 n + 556902 n + 8324765 n + 41571546) a(n + 17) - 1/3 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (5588 n + 282845 n + 4653937 n + 24693084) a(n + 18) - ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (13165 n + 630888 n + 9899243 n + 50748696) a(n + 19) + 1/6 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (9901 n + 533307 n + 9345992 n + 52782168) a(n + 20) + 1/3 ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (343 n + 27765 n + 714818 n + 5873448) a(n + 21) - 1/3 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2903 n + 137619 n + 1914142 n + 6453642) a(n + 22) - 1/3 ----------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2851 n + 166890 n + 3109607 n + 18009588) a(n + 23) - 1/6 ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (1441 n + 44028 n - 272209 n - 11919144) a(n + 24) + 1/6 ---------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (59 n + 3244 n + 65273 n + 524304) a(n + 25) - 1/2 ---------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (115 n + 13320 n + 454415 n + 4827444) a(n + 26) + 1/3 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (319 n + 23984 n + 600633 n + 5013848) a(n + 27) + 1/2 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 2 (49 n + 3826 n + 99640 n + 866182) a(n + 28) - ------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (193 n + 16188 n + 450299 n + 4152768) a(n + 29) - 1/6 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (67 n + 6120 n + 186029 n + 1881816) a(n + 31) + 1/6 ------------------------------------------------ + a(n + 33) (n + 30) (n + 29) (n + 33) 2 (7 n + 431 n + 6620) a(n + 32) - ------------------------------- = 0 (n + 33) (n + 30) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 28, a(8) = 66, a(9) = 148, a(10) = 325, a(11) = 700, a(12) = 1484, a(13) = 3115, a(14) = 6483, a(15) = 13397, a(16) = 27540, a(17) = 56365, a(18) = 114934, a(19) = 233671, a(20) = 473895, a(21) = 959064, a(22) = 1937574, a(23) = 3908687, a(24) = 7875203, a(25) = 15850255, a(26) = 31872995, a(27) = 64044070, a(28) = 128603849, a(29) = 258100711, a(30) = 517749182, a(31) = 1038184358, a(32) = 2081036022, a(33) = 4170193503 Lemma , 5.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 1, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 8 (n + 3) (n + 1) b(n) 2 (n + 4) (3 n + 7) b(n + 1) - ---------------------- - ---------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (17 n + 127 n + 226) b(n + 2) (11 n + 227 n + 748) b(n + 3) + ------------------------------ + 1/2 ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (83 n + 995 n + 2780) b(n + 4) (5 n + 175 n + 872) b(n + 5) - 1/4 ------------------------------- - 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (44 n + 653 n + 2374) b(n + 6) (7 n + 157 n + 822) b(n + 7) + 1/2 ------------------------------- - 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (23 n + 350 n + 1330) b(n + 8) (3 n + 8 n - 237) b(n + 9) - 1/2 ------------------------------- - 1/2 --------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (8 n + 109 n + 276) b(n + 10) + 1/2 ------------------------------ (n + 13) (n + 9) 2 (10 n + 211 n + 1083) b(n + 11) + 1/2 -------------------------------- (n + 13) (n + 9) 2 (19 n + 401 n + 2052) b(n + 12) - 1/4 -------------------------------- + b(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 7, b(7) = 17, b(8) = 39, b(9) = 86, b(10) = 189, b(11) = 408, b(12) = 868, b(13) = 1835 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.0575832 1/2 - --------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.8638 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 47.759, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 34 3 2 (225989 n + 11902635 n + 206915134 n + 1186535592) a(n + 20) -1/3 -------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (61775 n + 3363747 n + 60279037 n + 354926412) a(n + 21) + 2/3 ---------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (148669 n + 8583561 n + 163422170 n + 1024805400) a(n + 22) - 1/6 ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (37105 n + 2186004 n + 42187625 n + 265650528) a(n + 23) + 1/3 ---------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (9081 n + 537089 n + 10269924 n + 62726140) a(n + 24) - 1/2 ------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4321 n + 270334 n + 5492839 n + 35917878) a(n + 25) + 1/2 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (871 n + 43517 n + 538200 n - 100288) a(n + 26) - 1/2 ------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (455 n + 42942 n + 1309707 n + 13008736) a(n + 27) - 1/2 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (127 n + 11570 n + 346983 n + 3431320) a(n + 28) + -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (135 n + 11884 n + 347561 n + 3377250) a(n + 29) - -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (195 n + 17003 n + 493770 n + 4775540) a(n + 30) + 1/2 -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (27 n + 2507 n + 77524 n + 798392) a(n + 32) + 1/2 ---------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (n + 123 n + 461 n + 327) a(n + 2) - 512/3 ------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 256 (17 n + 221 n + 760 n + 698) a(n + 3) + ------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (514 n + 8733 n + 44492 n + 68445) a(n + 4) - 128/3 --------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1897 n + 36201 n + 212672 n + 387678) a(n + 5) + 64/3 ------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (8275 n + 162849 n + 1036427 n + 2125953) a(n + 6) - 32/3 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (25163 n + 588849 n + 4507570 n + 11257410) a(n + 7) + 16/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 4 (46913 n + 1176980 n + 9696507 n + 26200448) a(n + 8) - --------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (218297 n + 5999796 n + 54649183 n + 164718012) a(n + 9) + 4/3 ---------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (113102 n + 3395283 n + 33850909 n + 111989886) a(n + 10) - 8/3 ----------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 2 (190329 n + 6149140 n + 65959175 n + 234800892) a(n + 11) + ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (416799 n + 14306784 n + 163382805 n + 620933612) a(n + 12) - ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1126037 n + 41435904 n + 507282943 n + 2066779500) a(n + 13) + 1/3 --------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1180597 n + 46215282 n + 601105265 n + 2599177512) a(n + 14) - 1/3 --------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2007365 n + 82194462 n + 1117457101 n + 5048723712) a(n + 15) + 1/6 ---------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (270460 n + 11797763 n + 170884771 n + 822548462) a(n + 16) - ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1375753 n + 63085542 n + 958637963 n + 4830201690) a(n + 17) + 1/6 --------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (315727 n + 15051437 n + 237325124 n + 1238045088) a(n + 18) - 1/2 -------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (671683 n + 34017654 n + 570293099 n + 3165613764) a(n + 19) + 1/6 -------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 2 (6 n + 383 n + 6101) a(n + 33) - ------------------------------- + a(n + 34) (n + 34) (n + 31) 2 (5 n + 149) (13 n + 777 n + 11596) a(n + 31) - 1/2 --------------------------------------------- (n + 30) (n + 34) (n + 31) 2 (n + 2) (2 n - 7 n - 3) a(n + 1) - 1024/3 --------------------------------- (n + 30) (n + 34) (n + 31) 1024 (n - 1) (n + 2) (n + 1) a(n) + --------------------------------- = 0 (n + 30) (n + 34) (n + 31) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 27, a(8) = 63, a(9) = 142, a(10) = 310, a(11) = 665, a(12) = 1411, a(13) = 2958, a(14) = 6148, a(15) = 12708, a(16) = 26126, a(17) = 53466, a(18) = 109063, a(19) = 221850, a(20) = 450129, a(21) = 911492, a(22) = 1842745, a(23) = 3719991, a(24) = 7500406, a(25) = 15107538, a(26) = 30403345, a(27) = 61138743, a(28) = 122866932, a(29) = 246783216, a(30) = 495434834, a(31) = 994210356, a(32) = 1994420285, a(33) = 3999634122, a(34) = 8018744709 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 28 3 2 8 (137 n + 135 n - 1076 n - 864) b(n + 2) - ------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 12 (33 n - 651 n - 3404 n - 1888) b(n + 3) + -------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 6 (133 n + 2383 n + 8758 n + 3768) b(n + 4) + --------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 3 (881 n + 17529 n + 102002 n + 172320) b(n + 5) - -------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (4643 n + 116301 n + 827704 n + 1702064) b(n + 6) + 3/2 --------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (24365 n + 588969 n + 4368488 n + 9846304) b(n + 7) - 3/4 ----------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (246851 n + 6359853 n + 52278442 n + 135988176) b(n + 8) + 1/8 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (145537 n + 4248183 n + 39717380 n + 118235304) b(n + 9) - 1/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (123979 n + 3888869 n + 39457580 n + 128934080) b(n + 10) + 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (149337 n + 4910546 n + 52980149 n + 186944708) b(n + 11) - 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (140573 n + 4957283 n + 57681086 n + 220857024) b(n + 12) + 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (67491 n + 2543602 n + 31702581 n + 130462510) b(n + 13) - 3/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (126101 n + 4992909 n + 65546788 n + 285136400) b(n + 14) + 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (292331 n + 12268212 n + 171003181 n + 791531604) b(n + 15) - 1/8 ------------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (224545 n + 10049115 n + 149350280 n + 737012268) b(n + 16) + 1/8 ------------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (27888 n + 1315390 n + 20600541 n + 107124017) b(n + 17) - 3/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (35309 n + 1760115 n + 29146500 n + 160327752) b(n + 18) + 3/8 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (21759 n + 1151150 n + 20227143 n + 118023264) b(n + 19) - 3/8 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (19580 n + 1090473 n + 20172862 n + 123933744) b(n + 20) + 1/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (10061 n + 590118 n + 11500873 n + 74456964) b(n + 21) - 1/4 -------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (1624 n + 100459 n + 2064841 n + 14097640) b(n + 22) + 3/4 ------------------------------------------------------ (n + 24) (n + 28) (n + 26) 3 2 (776 n + 50292 n + 1083505 n + 7758289) b(n + 23) - 3/4 --------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (627 n + 42463 n + 956416 n + 7163220) b(n + 24) + 3/8 -------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (108 n + 7651 n + 180316 n + 1413585) b(n + 25) - 3/4 ------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (221 n + 16323 n + 401218 n + 3281784) b(n + 26) + 1/8 -------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (61 n + 4650 n + 117959 n + 995754) b(n + 27) - 1/8 ----------------------------------------------- + b(n + 28) (n + 24) (n + 28) (n + 26) 2 48 (n + 2) (17 n + 15 n - 48) b(n + 1) + --------------------------------------- (n + 24) (n + 28) (n + 26) 192 (n - 2) (n + 2) (n + 1) b(n) - -------------------------------- = 0 (n + 24) (n + 28) (n + 26) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 44, b(9) = 99, b(10) = 216, b(11) = 466, b(12) = 994, b(13) = 2095, b(14) = 4386, b(15) = 9132, b(16) = 18905, b(17) = 38972, b(18) = 80083, b(19) = 164053, b(20) = 335175, b(21) = 683373, b(22) = 1390709, b(23) = 2825383, b(24) = 5732001, b(25) = 11614650, b(26) = 23508295, b(27) = 47534859, b(28) = 96036524 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.1496 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6484 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 70.882, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 2]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 7.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 30 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) -64/3 ---------------------------- + 320/3 -------------------------------- (n + 30) (n + 27) (n + 26) (n + 30) (n + 27) (n + 26) 2 (10 n + 551 n + 7565) a(n + 29) - -------------------------------- + a(n + 30) (n + 27) (n + 30) 2 (n + 3) (43 n + 447 n + 1064) a(n + 2) - 16/3 --------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (37 n + 2936 n + 77563 n + 682240) a(n + 28) + ---------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (7795 n + 182184 n + 1465613 n + 4109280) a(n + 8) + 1/6 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (11368 n + 348369 n + 3280997 n + 9399516) a(n + 9) + 1/6 ----------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (1247 n - 4025 n - 640508 n - 4869616) a(n + 10) - 1/2 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (4601 n + 197370 n + 2883557 n + 14111892) a(n + 11) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (12215 n + 511107 n + 6362536 n + 23354688) a(n + 12) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 4 (1763 n + 78461 n + 1129606 n + 5285864) a(n + 13) + ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (4821 n + 250117 n + 4141498 n + 22161002) a(n + 14) - ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (12589 n + 717072 n + 12757523 n + 72383244) a(n + 15) + 1/6 -------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (12616 n + 528843 n + 7104191 n + 30016968) a(n + 16) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (2548 n + 101031 n + 1299495 n + 5466076) a(n + 17) + 1/2 ----------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (2509 n + 136215 n + 2678474 n + 18811068) a(n + 18) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (1629 n + 73448 n + 1050327 n + 4647608) a(n + 19) + 1/2 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (8971 n + 399351 n + 5313692 n + 18426312) a(n + 20) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (1661 n + 84733 n + 1384546 n + 7105170) a(n + 21) + ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (1423 n + 79008 n + 1432511 n + 8435535) a(n + 22) - 2/3 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (147 n + 5272 n + 19605 n - 548484) a(n + 23) + 1/2 ----------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (259 n + 17651 n + 399308 n + 2997736) a(n + 24) + 1/2 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (7 n + 181 n - 3600 n - 93738) a(n + 25) - ------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (13 n + 986 n + 24853 n + 208138) a(n + 26) + --------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (55 n + 4285 n + 111140 n + 959716) a(n + 27) - ----------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 8 (n + 164 n + 1169 n + 2126) a(n + 3) + ---------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 8 (53 n + 387 n - 26 n - 3270) a(n + 4) + ----------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (409 n - 2592 n - 74161 n - 265080) a(n + 5) - 2/3 ---------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 2 (314 n + 6981 n + 56431 n + 159980) a(n + 6) + ------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (3260 n + 89631 n + 819925 n + 2489706) a(n + 7) - 2/3 -------------------------------------------------- = 0 (n + 30) (n + 27) (n + 26) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 31, a(8) = 74, a(9) = 168, a(10) = 368, a(11) = 789, a(12) = 1663, a(13) = 3463, a(14) = 7147, a(15) = 14649, a(16) = 29869, a(17) = 60654, a(18) = 122782, a(19) = 247931, a(20) = 499667, a(21) = 1005458, a(22) = 2020775, a(23) = 4057448, a(24) = 8140568, a(25) = 16322685, a(26) = 32712777, a(27) = 65535263, a(28) = 131249786, a(29) = 262793810, a(30) = 526073271 Lemma , 7.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 4 (n + 1) (n + 2) b(n) 2 (n + 2) (n - 3) b(n + 1) - ---------------------- + -------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 (n + 7) (n + 2) b(n + 2) (33 n + 433 n + 1202) b(n + 3) + ------------------------ + 1/2 ------------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 3 (10 n + 116 n + 319) b(n + 4) (29 n + 331 n + 938) b(n + 5) - -------------------------------- + 1/4 ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (19 n + 45 n - 598) b(n + 6) (47 n + 789 n + 3252) b(n + 7) + 1/4 ----------------------------- + 1/2 ------------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (25 n + 455 n + 2104) b(n + 8) (10 n + 175 n + 766) b(n + 9) - 1/2 ------------------------------- - ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) 2 (22 n + 391 n + 1620) b(n + 10) - 1/2 -------------------------------- (n + 15) (n + 11) 2 2 (24 n + 437 n + 1865) b(n + 11) (n + 30 n + 212) b(n + 12) + 1/2 -------------------------------- + 3/2 --------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (7 n + 183 n + 1164) b(n + 13) (5 n + 127 n + 790) b(n + 14) + 1/4 ------------------------------- - 3/4 ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) + b(n + 15) = 0 Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 44, b(9) = 98, b(10) = 213, b(11) = 458, b(12) = 971, b(13) = 2041, b(14) = 4259, b(15) = 8837 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.053309 1/2 - -------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.7997 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 45.662, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 2]}, than in, {[1, 1, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 8.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 1, 2]}, then , {[1, 1, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 (n - 1) (n - 3) (n + 1) a(n) 32 (n - 2) (27 n + 57 n - 4) a(n + 1) 512/3 ---------------------------- + -------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 (n - 1) (106 n + 523 n + 264) a(n + 2) + 16/3 --------------------------------------- (n + 20) (n + 19) (n + 23) 2 n (809 n + 3750 n + 3001) a(n + 3) - 8/3 ----------------------------------- (n + 20) (n + 19) (n + 23) 2 (n + 1) (263 n + 2176 n + 3621) a(n + 4) - 16/3 ----------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2885 n + 17871 n + 2956 n - 36732) a(n + 5) + 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3596 n + 46275 n + 199033 n + 290196) a(n + 6) - 1/3 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (141 n + 12350 n + 123373 n + 268116) a(n + 7) + 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (18607 n + 313029 n + 1622054 n + 2707140) a(n + 8) + 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13639 n + 244392 n + 1325123 n + 2166930) a(n + 9) - 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (167 n - 4110 n - 119489 n - 543492) a(n + 10) - 1/3 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (2085 n + 46632 n + 317431 n + 654464) a(n + 11) + 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2869 n + 82765 n + 770364 n + 2297612) a(n + 12) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3163 n + 90240 n + 805451 n + 2194830) a(n + 13) + 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (305 n + 10793 n + 121000 n + 419206) a(n + 14) + ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1769 n + 60522 n + 655861 n + 2213700) a(n + 15) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (289 n + 11139 n + 140578 n + 583028) a(n + 16) + 1/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (41 n + 672 n - 11051 n - 184002) a(n + 17) - 1/6 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (50 n + 2193 n + 31339 n + 146010) a(n + 18) - 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11 n + 779 n + 17206 n + 121096) a(n + 19) - --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 2 (5 n + 277 n + 5086 n + 30938) a(n + 20) + -------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (8 n + 491 n + 10009 n + 67774) a(n + 21) + ------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (6 n + 251 n + 2614) a(n + 22) - ------------------------------- + a(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 31, a(8) = 73, a(9) = 164, a(10) = 357, a(11) = 762, a(12) = 1602, a(13) = 3332, a(14) = 6873, a(15) = 14090, a(16) = 28745, a(17) = 58422, a(18) = 118382, a(19) = 239313, a(20) = 482859, a(21) = 972776, a(22) = 1957357, a(23) = 3934549 Lemma , 8.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[2, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 3 2 (n - 1) (n - 3) (n + 1) b(n) 32 (13 n + 5 n - 58 n + 8) b(n + 1) -512/3 ---------------------------- - ------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 3 2 (68 n + 129 n - 77 n - 312) b(n + 2) + 16/3 -------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 8 (61 n + 276 n + 211 n + 304) b(n + 3) + ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (239 n + 1353 n + 1240 n + 6) b(n + 4) - 8/3 ---------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (327 n + 3225 n + 9392 n + 8372) b(n + 5) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (406 n + 8373 n + 48773 n + 83460) b(n + 6) + 1/3 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (4141 n + 57564 n + 228659 n + 246684) b(n + 7) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (1589 n + 27240 n + 150067 n + 275250) b(n + 8) + 1/3 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (556 n + 12879 n + 96668 n + 226989) b(n + 9) - 1/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (242 n + 5616 n + 41746 n + 100377) b(n + 10) - 2/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (234 n + 6360 n + 56059 n + 158767) b(n + 11) + ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (749 n + 23580 n + 243163 n + 815100) b(n + 12) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (16 n + 475 n + 4511 n + 13856) b(n + 13) + ------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 9420 n + 122771 n + 516186) b(n + 14) + 1/6 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 2 (227 n + 6051 n + 39190) b(n + 15) - 1/6 ----------------------------------- (n + 19) (n + 18) 3 2 (23 n + 994 n + 14247 n + 67728) b(n + 16) + 1/2 -------------------------------------------- (n + 15) (n + 19) (n + 18) 2 2 (11 n + 347 n + 2712) b(n + 17) (5 n + 164 n + 1331) b(n + 18) + 1/2 -------------------------------- - ------------------------------- (n + 18) (n + 15) (n + 19) (n + 15) + b(n + 19) = 0 Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 20, b(8) = 46, b(9) = 103, b(10) = 225, b(11) = 484, b(12) = 1027, b(13) = 2159, b(14) = 4504, b(15) = 9341, b(16) = 19277, b(17) = 39625, b(18) = 81182, b(19) = 165868 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.099749 1/2 - -------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 40.835, seconds to generate The best bet against, [1, 1, 1, 1], is a member of, {[1, 1, 1, 2], [2, 1, 1, 1]}, 0.987463 and then your edge, if you have n rolls, is approximately, -------- 1/2 n The next best bet is a member of, {[1, 1, 2, 2], [2, 2, 1, 1]}, 0.8062168 and then your edge is approximately, --------- 1/2 n The next best bet is a member of, {[1, 2, 2, 2], [2, 2, 2, 1]}, 0.746391 and then your edge is approximately, -------- 1/2 n The next best bet is a member of, {[1, 1, 2, 1], [1, 2, 1, 1]}, 0.6911 and then your edge is approximately, ------ 1/2 n The next best bet is a member of, {[1, 2, 2, 1]}, 0.63976 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[2, 1, 1, 2], [2, 1, 2, 2], [2, 2, 1, 2]}, 0.598451 and then your edge is approximately, -------- 1/2 n The next best bet is a member of, {[1, 2, 1, 2], [2, 1, 2, 1]}, 0.4988 and then your edge is approximately, ------ 1/2 n The next best bet is a member of, {[2, 2, 2, 2]}, and then your edge is exactly 0 ----------------------- This ends this chapter that took, 342.549, seconds to generate. ----------------------------------------------------------------- Chapter Number, 2 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 1, 1, 2], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) a(n) 6 (n + 5 n + 8) a(n + 1) - ----------------------- - ------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (n + 3) (5 n - 8) a(n + 2) (47 n + 451 n + 1092) a(n + 3) - -------------------------- + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (26 n + 261 n + 610) a(n + 4) (4 n - 3 n - 145) a(n + 5) - 1/2 ------------------------------ + 1/2 --------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (16 n + 343 n + 1632) a(n + 6) - 1/2 ------------------------------- (n + 13) (n + 9) 2 (40 n + 629 n + 2413) a(n + 7) + 1/2 ------------------------------- (n + 13) (n + 9) 2 2 (36 n + 547 n + 2054) a(n + 8) (2 n + 39 n + 219) a(n + 9) - 1/2 ------------------------------- + 1/2 ---------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (2 n + 37 n + 188) a(n + 10) (13 n + 252 n + 1163) a(n + 11) + 1/2 ----------------------------- + 1/2 -------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (5 n + 104 n + 522) a(n + 12) - ------------------------------ + a(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 2, a(6) = 5, a(7) = 12, a(8) = 27, a(9) = 62, a(10) = 136, a(11) = 296, a(12) = 638, a(13) = 1360 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 26 2 2 (15 n + 707 n + 8292) b(n + 25) 16 (n + 2) (7 n + 53 n + 98) b(n + 1) -1/2 -------------------------------- - -------------------------------------- (n + 26) (n + 23) (n + 23) (n + 22) (n + 26) 2 (n + 3) (79 n + 648 n + 1340) b(n + 2) - 8/3 --------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 4) (65 n + 628 n + 1386) b(n + 3) - 8/3 --------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 5) (29 n + 236 n + 108) b(n + 4) - 2/3 -------------------------------------- (n + 23) (n + 22) (n + 26) 32 (n + 4) (n + 2) (n + 1) b(n) - ------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (213 n + 4767 n + 36288 n + 91804) b(n + 5) + --------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (81 n + 601 n - 10194 n - 72944) b(n + 6) + 1/2 ------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (596 n + 24297 n + 291037 n + 1084080) b(n + 7) - 1/3 ------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (1645 n + 58343 n + 656286 n + 2383976) b(n + 8) - 1/2 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (331 n + 12714 n + 138155 n + 434718) b(n + 9) - 1/3 ------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (529 n + 42213 n + 734342 n + 3717216) b(n + 10) + 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (5591 n + 232575 n + 3158530 n + 14087568) b(n + 11) + 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (1013 n + 39041 n + 503132 n + 2175120) b(n + 12) - 1/2 --------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (585 n + 19755 n + 216738 n + 758120) b(n + 13) + 1/2 ------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (345 n + 21595 n + 404428 n + 2372924) b(n + 14) - 1/2 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (3479 n + 158445 n + 2371504 n + 11660352) b(n + 15) + 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (4733 n + 207999 n + 3010018 n + 14293800) b(n + 16) - 1/6 ------------------------------------------------------ + b(n + 26) (n + 23) (n + 22) (n + 26) 3 2 (157 n + 7761 n + 128012 n + 699980) b(n + 17) + 1/2 ------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (389 n + 17601 n + 266278 n + 1354848) b(n + 18) + 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (1261 n + 59337 n + 898610 n + 4320504) b(n + 19) + 1/6 --------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (817 n + 36609 n + 503048 n + 1961808) b(n + 20) - 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (179 n + 7533 n + 86686 n + 157152) b(n + 21) + 1/6 ----------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (58 n + 3453 n + 68237 n + 447690) b(n + 22) - 1/3 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (35 n + 2403 n + 54634 n + 411528) b(n + 23) - 1/6 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (26 n + 1755 n + 39406 n + 294372) b(n + 24) + 2/3 ---------------------------------------------- = 0 (n + 23) (n + 22) (n + 26) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 20, b(8) = 46, b(9) = 105, b(10) = 233, b(11) = 508, b(12) = 1095, b(13) = 2332, b(14) = 4929, b(15) = 10345, b(16) = 21585, b(17) = 44824, b(18) = 92686, b(19) = 190975, b(20) = 392272, b(21) = 803553, b(22) = 1642148, b(23) = 3348847, b(24) = 6816665, b(25) = 13852607, b(26) = 28109365 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 1.058 1/2 - ----- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.070537 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 35.062, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 2.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) 32/5 ---------------------------- + 64/5 -------------------------------- (n + 11) (n + 16) (n + 15) (n + 11) (n + 16) (n + 15) 2 (n + 3) (8 n + 99 n + 265) a(n + 2) + 16/5 ------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 4) (n + 35 n + 114) a(n + 3) - 8/5 ---------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 5) (161 n + 2183 n + 7452) a(n + 4) - 2/5 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 6) (49 n + 543 n + 1178) a(n + 5) + 2/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 7) (7 n + 169 n + 894) a(n + 6) + 18/5 ------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 8) (25 n + 122 n - 1219) a(n + 7) - 3/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 9) (197 n + 681 n - 10208) a(n + 8) + 1/10 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 10) (95 n + 2569 n + 18810) a(n + 9) - 1/10 ------------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 355 n + 3838) a(n + 10) + 3/5 ----------------------------- (n + 16) (n + 15) 2 (n + 12) (113 n + 3339 n + 23152) a(n + 11) - 1/10 -------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 13) (7 n + 168 n + 1028) a(n + 12) + 3/5 ---------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 14) (77 n + 1925 n + 11652) a(n + 13) + 1/10 ------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (11 n + 279 n + 1726) a(n + 14) - 1/2 -------------------------------- + a(n + 15) = 0 (n + 16) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 18, a(8) = 42, a(9) = 93, a(10) = 204, a(11) = 435, a(12) = 924, a(13) = 1940, a(14) = 4054, a(15) = 8408 Lemma , 2.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) -32/3 ---------------------------- + 64/3 -------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (5 n + 36 n + 85) b(n + 2) + 16/3 ----------------------------------- (n + 13) (n + 17) (n + 16) 3 2 8 (8 n + 85 n + 299 n + 342) b(n + 3) - --------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (19 n + 984 n + 8621 n + 20928) b(n + 4) - 2/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (17 n + 195 n - 668 n - 7290) b(n + 5) + 2/3 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (203 n + 6354 n + 59527 n + 174384) b(n + 6) + 1/3 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (23 n + 1134 n + 6607 n - 6432) b(n + 7) - 1/6 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (547 n + 18831 n + 207812 n + 741912) b(n + 8) - 1/6 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (173 n + 5736 n + 60643 n + 206404) b(n + 9) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (10 n - 194 n - 8093 n - 51962) b(n + 10) - ------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (79 n + 3191 n + 41760 n + 178392) b(n + 11) - ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (275 n + 10206 n + 125812 n + 515310) b(n + 12) + 1/3 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (161 n + 5904 n + 72577 n + 299874) b(n + 13) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1917 n + 25794 n + 114272) b(n + 14) - 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1984 n + 27751 n + 128474) b(n + 15) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) b(n + 16) - ------------------------------- + b(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 45, b(9) = 101, b(10) = 222, b(11) = 477, b(12) = 1016, b(13) = 2139, b(14) = 4471, b(15) = 9279, b(16) = 19170, b(17) = 39432 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.89763 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 28.248, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 2]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 n (n + 1) (n + 2) a(n) (n + 6) (n + 2) (n + 1) a(n + 1) 128/5 -------------------------- + 128/5 -------------------------------- (n + 22) (n + 18) (n + 23) (n + 22) (n + 18) (n + 23) 2 (n + 2) (n + 40 n + 114) a(n + 2) + 64/5 ---------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (47 n + 696 n + 3067 n + 4200) a(n + 3) - 32/5 ----------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (89 n + 1749 n + 10102 n + 18360) a(n + 4) + 8/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (146 n + 2535 n + 14563 n + 27540) a(n + 5) + 24/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1135 n + 20307 n + 118808 n + 226272) a(n + 6) - 4/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (41 n - 1971 n - 35405 n - 137016) a(n + 7) + 8/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (761 n + 20961 n + 188354 n + 557392) a(n + 8) + 3/5 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (1246 n + 11163 n - 101365 n - 892320) a(n + 9) - 1/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (747 n + 39325 n + 564716 n + 2467240) a(n + 10) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (5164 n + 186213 n + 2277779 n + 9455376) a(n + 11) + 1/10 ----------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (429 n + 10722 n + 83205 n + 200240) a(n + 12) - 3/10 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4423 n + 192690 n + 2803421 n + 13632954) a(n + 13) - 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4681 n + 206508 n + 3065069 n + 15295650) a(n + 14) + 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (529 n + 23526 n + 345573 n + 1670800) a(n + 15) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (310 n + 16167 n + 284545 n + 1686224) a(n + 16) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1673 n + 86031 n + 1472158 n + 8377752) a(n + 17) + 1/10 ---------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (445 n + 23166 n + 398075 n + 2252814) a(n + 18) - 1/5 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (2 n + 369 n + 12229 n + 112830) a(n + 19) - 2/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (34 n + 2035 n + 40481 n + 267520) a(n + 20) + 3/5 ---------------------------------------------- (n + 22) (n + 18) (n + 23) 2 (8 n + 313 n + 3033) a(n + 21) - ------------------------------- + a(n + 22) = 0 (n + 23) (n + 18) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 22, a(8) = 48, a(9) = 105, a(10) = 225, a(11) = 474, a(12) = 990, a(13) = 2060, a(14) = 4266, a(15) = 8794, a(16) = 18061, a(17) = 36996, a(18) = 75606, a(19) = 154191, a(20) = 313884, a(21) = 637997, a(22) = 1295065 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 2, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 24 2 2 (9 n + 381 n + 4010) b(n + 23) 128 (n + 1) (n + 2) b(n + 1) b(n + 24) - ------------------------------- - ----------------------------- (n + 24) (n + 20) (n + 20) (n + 24) (n + 23) 2 (n + 2) (5 n + 44 n + 90) b(n + 2) + 64/3 ----------------------------------- (n + 20) (n + 24) (n + 23) n (n + 1) (n + 2) b(n) + 128/3 -------------------------- (n + 20) (n + 24) (n + 23) 3 2 (15359 n + 601886 n + 7752881 n + 32721250) b(n + 14) - 1/2 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (15259 n + 498897 n + 4779314 n + 11047158) b(n + 15) + 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3915 n + 199999 n + 3338804 n + 18243672) b(n + 16) + 1/2 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (13358 n + 622347 n + 9557149 n + 48264816) b(n + 17) - 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3194 n + 132441 n + 1710421 n + 6525726) b(n + 18) + 1/6 ----------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (339 n + 19763 n + 379686 n + 2404056) b(n + 19) + -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (1427 n + 79242 n + 1456507 n + 8850516) b(n + 20) - 1/6 ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (45 n + 2085 n + 28960 n + 105652) b(n + 21) + 1/2 ---------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 2 (12 n + 782 n + 16929 n + 121718) b(n + 22) + ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (n + 198 n + 1271 n + 2016) b(n + 3) - 32/3 -------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (121 n + 3957 n + 26918 n + 51576) b(n + 4) + 8/3 --------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (410 n + 11331 n + 84115 n + 187380) b(n + 5) - 8/3 ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 4 (89 n - 55 n - 6980 n - 18192) b(n + 6) - ------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4643 n + 113547 n + 932104 n + 2559744) b(n + 7) + 4/3 --------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (9379 n + 249095 n + 2183394 n + 6313392) b(n + 8) - ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4088 n + 43659 n - 354719 n - 3800544) b(n + 9) + 1/3 -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (64537 n + 2209815 n + 24899180 n + 92453784) b(n + 10) + 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (75946 n + 2486535 n + 26818235 n + 95084496) b(n + 11) - 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (19910 n + 400407 n + 886627 n - 12517440) b(n + 12) + 1/6 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (6258 n + 274251 n + 3910486 n + 18209561) b(n + 13) + ------------------------------------------------------ = 0 (n + 20) (n + 24) (n + 23) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 10, b(7) = 23, b(8) = 52, b(9) = 115, b(10) = 247, b(11) = 522, b(12) = 1094, b(13) = 2279, b(14) = 4718, b(15) = 9719, b(16) = 19947, b(17) = 40821, b(18) = 83326, b(19) = 169718, b(20) = 345044, b(21) = 700405, b(22) = 1419839, b(23) = 2874874, b(24) = 5815036 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.89761 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 44.088, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 5.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 6 2 4 (n + 1) a(n) 2 (n + 13) a(n + 1) (9 n + 61 n + 94) a(n + 2) - -------------- - ------------------- + --------------------------- n + 6 n + 6 (n + 6) (n + 2) 2 2 (7 n + 59 n + 130) a(n + 3) (3 n + 27 n + 56) a(n + 4) - 1/2 ---------------------------- + --------------------------- (n + 6) (n + 2) (n + 6) (n + 2) 2 (7 n + 55 n + 88) a(n + 5) - 1/2 --------------------------- + a(n + 6) = 0 (n + 6) (n + 2) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10 Lemma , 5.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 8 (n + 1) (n + 2) (n + 3) b(n) 8 (2 n - 1) (n + 3) (n + 2) b(n + 1) - ------------------------------ + ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 6 (n + 3) (5 n + 37 n + 92) b(n + 2) - ------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (85 n + 1236 n + 5849 n + 9018) b(n + 3) + ------------------------------------------ (n + 9) (n + 7) (n + 11) 3 2 (145 n + 2391 n + 12944 n + 23136) b(n + 4) - --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (209 n + 3896 n + 23899 n + 48348) b(n + 5) + 3/4 --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (175 n + 3509 n + 23130 n + 50136) b(n + 6) - 3/4 --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 3 (31 n + 642 n + 4382 n + 9839) b(n + 7) + ------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (56 n + 1224 n + 8821 n + 20922) b(n + 8) - ------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (35 n + 828 n + 6453 n + 16548) b(n + 9) + 3/4 ------------------------------------------ (n + 9) (n + 7) (n + 11) 3 2 (31 n + 789 n + 6602 n + 18144) b(n + 10) - 1/4 ------------------------------------------- + b(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 28, b(8) = 66, b(9) = 146, b(10) = 315, b(11) = 668 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7053 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 18.143, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 32 (n + 1) (n + 2) (n + 3) a(n) 8 (11 n + 23) (n + 3) (n + 2) a(n + 1) ------------------------------- - -------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 2 4 (n + 3) (19 n + 29 n - 122) a(n + 2) + --------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (11 n + 32 n + 77 n + 464) a(n + 3) - --------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (139 n + 3536 n + 26625 n + 61876) a(n + 4) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (543 n + 12922 n + 97251 n + 235528) a(n + 5) - ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (865 n + 20848 n + 163745 n + 421762) a(n + 6) + ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (729 n + 18954 n + 162871 n + 463750) a(n + 7) - ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (589 n + 18708 n + 192295 n + 645056) a(n + 8) + 1/2 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (69 n + 4646 n + 64553 n + 251400) a(n + 9) - 1/2 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (129 n + 2864 n + 8441 n - 78726) a(n + 10) + 1/2 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (259 n + 3818 n - 18479 n - 323286) a(n + 11) - 1/2 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 3976 n - 7847 n - 260492) a(n + 12) + 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (89 n + 2500 n + 20433 n + 38846) a(n + 13) - --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (72 n + 2759 n + 35133 n + 148694) a(n + 14) + ---------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (61 n + 2458 n + 32675 n + 143014) a(n + 15) - 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 2 (n + 16) (15 n + 510 n + 4243) a(n + 16) - ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (43 n + 2088 n + 33709 n + 180896) a(n + 17) + 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 2 4 (2 n + 64 n + 509) a(n + 18) - ------------------------------- + a(n + 19) = 0 (n + 19) (n + 15) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 57, a(9) = 123, a(10) = 261, a(11) = 549, a(12) = 1144, a(13) = 2366, a(14) = 4870, a(15) = 9982, a(16) = 20402, a(17) = 41593, a(18) = 84620, a(19) = 171864 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 2, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) b(n) 8 (7 n + 23) (n + 3) (n + 2) b(n + 1) -32/3 ---------------------------- + ------------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (79 n + 543 n + 914) b(n + 2) - 4/3 -------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 2 (33 n + 302 n + 793 n + 456) b(n + 3) + ----------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (65 n + 1122 n + 5437 n + 7332) b(n + 4) + 1/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (30 n + 209 n - 661 n - 4956) b(n + 5) - ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (35 n + 1791 n + 22708 n + 82704) b(n + 6) + 1/3 -------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (247 n + 10383 n + 118526 n + 409968) b(n + 7) - 1/3 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (301 n + 10370 n + 110313 n + 373320) b(n + 8) + 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (370 n + 10647 n + 96701 n + 275448) b(n + 9) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (153 n + 5619 n + 67674 n + 268232) b(n + 10) - 1/2 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (373 n + 13551 n + 164192 n + 663912) b(n + 11) + 1/6 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (81 n + 2745 n + 30302 n + 108032) b(n + 12) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (371 n + 13395 n + 159412 n + 623520) b(n + 13) - 1/6 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (30 n + 1031 n + 11343 n + 39086) b(n + 14) + 1/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (61 n + 2742 n + 40823 n + 201222) b(n + 15) + 1/6 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (19 n + 545 n + 3864) b(n + 16) - 1/3 -------------------------------- + b(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 27, b(8) = 61, b(9) = 134, b(10) = 287, b(11) = 605, b(12) = 1262, b(13) = 2609, b(14) = 5365, b(15) = 10981, b(16) = 22402, b(17) = 45582 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.73292 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.5701 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 33.616, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 2]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 9, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 9.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 2, 1]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 2 48 (n - 1) (n - 2) (n + 1) a(n) 24 (n - 1) (5 n + 4 n - 8) a(n + 1) ------------------------------- - ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 24 n (n - 15 n - 44) a(n + 2) + ------------------------------ (n + 9) (n + 7) (n + 11) 2 6 (n + 1) (17 n + 157 n + 334) a(n + 3) + ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 3 (n + 2) (20 n + 197 n + 499) a(n + 4) - ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 3) (100 n + 1083 n + 2798) a(n + 5) + 1/2 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 4) (329 n + 3421 n + 8190) a(n + 6) - 1/4 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 5) (31 n + 350 n + 926) a(n + 7) + 3/2 -------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 6) (28 n + 429 n + 1652) a(n + 8) - 1/2 --------------------------------------- (n + 9) (n + 7) (n + 11) 2 (7 n + 123 n + 532) a(n + 9) + 3/2 ----------------------------- (n + 11) (n + 9) 2 (n + 8) (23 n + 401 n + 1698) a(n + 10) - 1/4 ---------------------------------------- + a(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 58, a(9) = 126, a(10) = 268, a(11) = 562 Lemma , 9.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[2, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 2 48 (n - 1) (n - 2) (n + 1) b(n) 24 (n - 1) (13 n + 20 n - 8) b(n + 1) - ------------------------------- + -------------------------------------- (n + 15) (n + 13) (n + 11) (n + 15) (n + 13) (n + 11) 3 2 8 (101 n + 279 n + 10 n + 12) b(n + 2) - ---------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 2 (613 n + 3186 n + 4019 n + 1806) b(n + 3) + --------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1420 n + 11397 n + 26957 n + 20070) b(n + 4) - ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (2876 n + 30981 n + 102301 n + 104286) b(n + 5) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (5059 n + 68451 n + 293006 n + 400344) b(n + 6) - 1/4 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1967 n + 32841 n + 177064 n + 308310) b(n + 7) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1375 n + 27294 n + 175778 n + 364884) b(n + 8) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (285 n + 6571 n + 49486 n + 120990) b(n + 9) + 3/2 ---------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (493 n + 13020 n + 112778 n + 318696) b(n + 10) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (253 n + 7407 n + 71288 n + 224754) b(n + 11) + 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (109 n + 3510 n + 37382 n + 131556) b(n + 12) - 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (43 n + 1524 n + 17915 n + 69834) b(n + 13) + 1/2 --------------------------------------------- (n + 15) (n + 13) (n + 11) 2 (3 n + 38) (3 n + 75 n + 460) b(n + 14) - 3/4 ---------------------------------------- + b(n + 15) = 0 (n + 15) (n + 13) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 30, b(8) = 69, b(9) = 152, b(10) = 325, b(11) = 682, b(12) = 1415, b(13) = 2912, b(14) = 5958, b(15) = 12142 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.70526 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 25.370, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 10, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 1, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 11, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 2, 1]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 12, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 2, 2]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 12.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 2, 2]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 4 (n + 1) (n + 2) a(n) 2 (n + 2) (n - 3) a(n + 1) - ---------------------- + -------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 (n + 7) (n + 2) a(n + 2) (33 n + 433 n + 1202) a(n + 3) + ------------------------ + 1/2 ------------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 3 (10 n + 116 n + 319) a(n + 4) (29 n + 331 n + 938) a(n + 5) - -------------------------------- + 1/4 ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (19 n + 45 n - 598) a(n + 6) (47 n + 789 n + 3252) a(n + 7) + 1/4 ----------------------------- + 1/2 ------------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (25 n + 455 n + 2104) a(n + 8) (10 n + 175 n + 766) a(n + 9) - 1/2 ------------------------------- - ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) 2 (22 n + 391 n + 1620) a(n + 10) - 1/2 -------------------------------- (n + 15) (n + 11) 2 2 (24 n + 437 n + 1865) a(n + 11) (n + 30 n + 212) a(n + 12) + 1/2 -------------------------------- + 3/2 --------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (7 n + 183 n + 1164) a(n + 13) (5 n + 127 n + 790) a(n + 14) + 1/4 ------------------------------- - 3/4 ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) + a(n + 15) = 0 Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 44, a(9) = 98, a(10) = 213, a(11) = 458, a(12) = 971, a(13) = 2041, a(14) = 4259, a(15) = 8837 Lemma , 12.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[2, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 30 2 (n + 3) (43 n + 447 n + 1064) b(n + 2) -16/3 --------------------------------------- (n + 30) (n + 27) (n + 26) (n + 1) (n + 2) (n + 3) b(n) - 64/3 ---------------------------- (n + 30) (n + 27) (n + 26) (n + 4) (n + 3) (n + 2) b(n + 1) + 320/3 -------------------------------- + b(n + 30) (n + 30) (n + 27) (n + 26) 3 2 (8971 n + 399351 n + 5313692 n + 18426312) b(n + 20) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (1661 n + 84733 n + 1384546 n + 7105170) b(n + 21) + ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (1423 n + 79008 n + 1432511 n + 8435535) b(n + 22) - 2/3 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (147 n + 5272 n + 19605 n - 548484) b(n + 23) + 1/2 ----------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (259 n + 17651 n + 399308 n + 2997736) b(n + 24) + 1/2 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (7 n + 181 n - 3600 n - 93738) b(n + 25) - ------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (13 n + 986 n + 24853 n + 208138) b(n + 26) + --------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (55 n + 4285 n + 111140 n + 959716) b(n + 27) - ----------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (37 n + 2936 n + 77563 n + 682240) b(n + 28) + ---------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 8 (n + 164 n + 1169 n + 2126) b(n + 3) + ---------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 8 (53 n + 387 n - 26 n - 3270) b(n + 4) + ----------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (409 n - 2592 n - 74161 n - 265080) b(n + 5) - 2/3 ---------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 2 (314 n + 6981 n + 56431 n + 159980) b(n + 6) + ------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (3260 n + 89631 n + 819925 n + 2489706) b(n + 7) - 2/3 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (7795 n + 182184 n + 1465613 n + 4109280) b(n + 8) + 1/6 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (11368 n + 348369 n + 3280997 n + 9399516) b(n + 9) + 1/6 ----------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (1247 n - 4025 n - 640508 n - 4869616) b(n + 10) - 1/2 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (4601 n + 197370 n + 2883557 n + 14111892) b(n + 11) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (12215 n + 511107 n + 6362536 n + 23354688) b(n + 12) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 4 (1763 n + 78461 n + 1129606 n + 5285864) b(n + 13) + ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (4821 n + 250117 n + 4141498 n + 22161002) b(n + 14) - ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (12589 n + 717072 n + 12757523 n + 72383244) b(n + 15) + 1/6 -------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (12616 n + 528843 n + 7104191 n + 30016968) b(n + 16) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (2548 n + 101031 n + 1299495 n + 5466076) b(n + 17) + 1/2 ----------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (2509 n + 136215 n + 2678474 n + 18811068) b(n + 18) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (1629 n + 73448 n + 1050327 n + 4647608) b(n + 19) + 1/2 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 2 (10 n + 551 n + 7565) b(n + 29) - -------------------------------- = 0 (n + 27) (n + 30) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 74, b(9) = 168, b(10) = 368, b(11) = 789, b(12) = 1663, b(13) = 3463, b(14) = 7147, b(15) = 14649, b(16) = 29869, b(17) = 60654, b(18) = 122782, b(19) = 247931, b(20) = 499667, b(21) = 1005458, b(22) = 2020775, b(23) = 4057448, b(24) = 8140568, b(25) = 16322685, b(26) = 32712777, b(27) = 65535263, b(28) = 131249786, b(29) = 262793810, b(30) = 526073271 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7997 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.053309 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 44.448, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 13, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 1, 1, 2]}, than in, {[1, 1, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 13.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 1, 2]}, then , {[1, 1, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) a(n) 2 (11 n + 67 n + 84) a(n + 1) - ----------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (15 n + 109 n + 180) a(n + 2) (33 n + 413 n + 1116) a(n + 3) - ------------------------------ + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (29 n + 642 n + 2424) a(n + 4) (5 n + 217 n + 1050) a(n + 5) - 1/2 ------------------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (25 n + 323 n + 948) a(n + 6) (20 n + 31 n - 963) a(n + 7) - 1/2 ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (5 n + 199 n + 1332) a(n + 8) (11 n + 91 n - 144) a(n + 9) + ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (49 n + 887 n + 3882) a(n + 10) 7 (3 n + 59 n + 282) a(n + 11) - 1/2 -------------------------------- + ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (15 n + 313 n + 1584) a(n + 12) - 1/2 -------------------------------- + a(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 30, a(8) = 69, a(9) = 150, a(10) = 315, a(11) = 648, a(12) = 1318, a(13) = 2668 Lemma , 13.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[2, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 32 (n + 4) (n + 2) (n + 1) b(n) 16 (n + 2) (9 n + 65 n + 108) b(n + 1) ------------------------------- - --------------------------------------- (n + 18) (n + 22) (n + 21) (n + 18) (n + 22) (n + 21) 3 2 (95 n + 1059 n + 3766 n + 4344) b(n + 2) + 8/3 ------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (58 n + 588 n + 1649 n + 948) b(n + 3) - 8/3 ---------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 2 (77 n + 1717 n + 11448 n + 23888) b(n + 4) - ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (399 n + 7615 n + 47330 n + 96288) b(n + 5) + --------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2779 n + 62073 n + 469100 n + 1196448) b(n + 6) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (915 n + 32374 n + 348995 n + 1187704) b(n + 7) + 1/2 ------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1265 n + 65070 n + 854836 n + 3347712) b(n + 8) - 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2039 n + 110352 n + 1527949 n + 6306432) b(n + 9) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (233 n + 7014 n + 43294 n - 50514) b(n + 10) - 1/3 ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2576 n + 128403 n + 1965073 n + 9540192) b(n + 11) - 1/6 ----------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (3815 n + 182034 n + 2771779 n + 13664040) b(n + 12) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (230 n + 36177 n + 859681 n + 5586654) b(n + 13) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (790 n + 30120 n + 374437 n + 1504222) b(n + 14) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (5555 n + 234558 n + 3278533 n + 15147966) b(n + 15) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (372 n + 16392 n + 239811 n + 1164842) b(n + 16) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (346 n + 17883 n + 305455 n + 1723402) b(n + 17) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1876 n + 97989 n + 1700417 n + 9798390) b(n + 18) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (385 n + 20949 n + 378914 n + 2277356) b(n + 19) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (197 n + 11163 n + 210262 n + 1316016) b(n + 20) + 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 2 (37 n + 1401 n + 13184) b(n + 21) - 1/3 ---------------------------------- + b(n + 22) = 0 (n + 22) (n + 18) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 73, b(9) = 162, b(10) = 345, b(11) = 716, b(12) = 1462, b(13) = 2959, b(14) = 5965, b(15) = 12013, b(16) = 24206, b(17) = 48822, b(18) = 98550, b(19) = 198999, b(20) = 401783, b(21) = 810802, b(22) = 1635017 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.63472 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 31.087, seconds to generate The best bet against, [1, 1, 1, 2], is a member of, {[1, 1, 2, 2], [1, 2, 2, 2], [2, 1, 1, 1], [2, 2, 1, 1], [2, 2, 2, 1]}, and then your edge, if you have n rolls, is exactly 0 The next best bet is a member of, {[2, 1, 1, 2], [2, 1, 2, 2], [2, 2, 1, 2]}, 0.14102 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 2, 2, 1]}, 0.16282 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 2, 1, 1]}, 0.19941 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 1, 2, 1]}, 0.19943 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[2, 1, 2, 1]}, 0.28206 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 2, 1, 2]}, 0.2821 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[2, 2, 2, 2]}, 0.746391 and then your edge is approximately, - -------- 1/2 n The next best bet is a member of, {[1, 1, 1, 1]}, 0.987463 and then your edge is approximately, - -------- 1/2 n ----------------------- This ends this chapter that took, 260.318, seconds to generate. ----------------------------------------------------------------- Chapter Number, 3 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 1, 2, 1], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 180 (n + 1) (n + 2) (n + 3) a(n) 90 (7 n + 24) (n + 3) (n + 2) a(n + 1) - -------------------------------- + -------------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 9 (n + 3) (49 n + 284 n + 262) a(n + 2) - ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (301 n + 4620 n + 23243 n + 38016) a(n + 3) - 3/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (n + 6) (301 n + 1657 n + 712) a(n + 4) + 3/2 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (5 n + 332 n + 2795 n + 5840) a(n + 5) + 9/2 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (196 n + 8592 n + 94925 n + 309540) a(n + 6) + ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (657 n + 25940 n + 277927 n + 901404) a(n + 7) - 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (10 n + 709 n - 1971 n - 62124) a(n + 8) + 1/2 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (492 n + 18831 n + 226801 n + 876098) a(n + 9) + 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (205 n + 7231 n + 82511 n + 306762) a(n + 10) - ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (32 n + 1511 n + 21647 n + 97322) a(n + 11) - 1/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (289 n + 10155 n + 117682 n + 448876) a(n + 12) + 1/2 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (168 n + 5893 n + 67995 n + 257178) a(n + 13) - 1/2 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (7 n + 472 n + 8779 n + 49522) a(n + 14) - 1/2 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (21 n + 897 n + 12698 n + 59512) a(n + 15) + -------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) a(n + 16) - ------------------------------- + a(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 7, a(7) = 16, a(8) = 37, a(9) = 85, a(10) = 186, a(11) = 400, a(12) = 852, a(13) = 1809, a(14) = 3810, a(15) = 7959, a(16) = 16538, a(17) = 34236 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 108 (n + 1) (n + 2) (n + 3) b(n) 18 (5 n - 8) (n + 3) (n + 2) b(n + 1) - -------------------------------- + ------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 9 (n + 3) (3 n - 136 n - 486) b(n + 2) - --------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (929 n + 16728 n + 97195 n + 180384) b(n + 3) + 3/2 ----------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2919 n + 61069 n + 404414 n + 859080) b(n + 4) - 3/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 3 (2503 n + 52430 n + 354549 n + 780372) b(n + 5) + --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11509 n + 196683 n + 912944 n + 716016) b(n + 6) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (6379 n + 274786 n + 3311107 n + 12129000) b(n + 7) - 1/2 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13231 n + 404682 n + 4028539 n + 13111554) b(n + 8) + ------------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (43571 n + 1340529 n + 13406095 n + 43661151) b(n + 9) - 1/3 -------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (14137 n + 473355 n + 5062871 n + 17353992) b(n + 10) + 1/3 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (31093 n + 962520 n + 9998447 n + 34970628) b(n + 11) + 1/6 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (36862 n + 1204185 n + 13159061 n + 48384168) b(n + 12) - 1/6 --------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3277 n + 112227 n + 1345416 n + 5760706) b(n + 13) + 1/2 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11153 n + 365859 n + 3603832 n + 9419928) b(n + 14) + 1/6 ------------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (13609 n + 475785 n + 5208548 n + 17116026) b(n + 15) - 1/6 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2165 n + 81975 n + 999684 n + 3889716) b(n + 16) + 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1358 n + 60405 n + 906109 n + 4615698) b(n + 17) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (9 n + 1382 n + 39477 n + 314290) b(n + 18) + 1/2 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (293 n + 15630 n + 278767 n + 1664322) b(n + 19) + 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (133 n + 7577 n + 143668 n + 906828) b(n + 20) - 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (229 n + 13380 n + 260021 n + 1681086) b(n + 21) + 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (10 n + 411 n + 4198) b(n + 22) - -------------------------------- + b(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 59, b(9) = 133, b(10) = 293, b(11) = 632, b(12) = 1340, b(13) = 2818, b(14) = 5888, b(15) = 12224, b(16) = 25228, b(17) = 51823, b(18) = 106094, b(19) = 216560, b(20) = 440879, b(21) = 895460, b(22) = 1815261, b(23) = 3673951 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.8063 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.1152 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 39.095, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 2.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) -32/3 ---------------------------- + 64/3 -------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (5 n + 36 n + 85) a(n + 2) + 16/3 ----------------------------------- (n + 13) (n + 17) (n + 16) 3 2 8 (8 n + 85 n + 299 n + 342) a(n + 3) - --------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (19 n + 984 n + 8621 n + 20928) a(n + 4) - 2/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (17 n + 195 n - 668 n - 7290) a(n + 5) + 2/3 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (203 n + 6354 n + 59527 n + 174384) a(n + 6) + 1/3 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (23 n + 1134 n + 6607 n - 6432) a(n + 7) - 1/6 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (547 n + 18831 n + 207812 n + 741912) a(n + 8) - 1/6 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (173 n + 5736 n + 60643 n + 206404) a(n + 9) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (10 n - 194 n - 8093 n - 51962) a(n + 10) - ------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (79 n + 3191 n + 41760 n + 178392) a(n + 11) - ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (275 n + 10206 n + 125812 n + 515310) a(n + 12) + 1/3 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (161 n + 5904 n + 72577 n + 299874) a(n + 13) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1917 n + 25794 n + 114272) a(n + 14) - 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1984 n + 27751 n + 128474) a(n + 15) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) a(n + 16) - ------------------------------- + a(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 45, a(9) = 101, a(10) = 222, a(11) = 477, a(12) = 1016, a(13) = 2139, a(14) = 4471, a(15) = 9279, a(16) = 19170, a(17) = 39432 Lemma , 2.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) 32/5 ---------------------------- + 64/5 -------------------------------- (n + 11) (n + 16) (n + 15) (n + 11) (n + 16) (n + 15) 2 (n + 3) (8 n + 99 n + 265) b(n + 2) + 16/5 ------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 4) (n + 35 n + 114) b(n + 3) - 8/5 ---------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 5) (161 n + 2183 n + 7452) b(n + 4) - 2/5 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 6) (49 n + 543 n + 1178) b(n + 5) + 2/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 7) (7 n + 169 n + 894) b(n + 6) + 18/5 ------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 8) (25 n + 122 n - 1219) b(n + 7) - 3/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 9) (197 n + 681 n - 10208) b(n + 8) + 1/10 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 10) (95 n + 2569 n + 18810) b(n + 9) - 1/10 ------------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 355 n + 3838) b(n + 10) + 3/5 ----------------------------- (n + 16) (n + 15) 2 (n + 12) (113 n + 3339 n + 23152) b(n + 11) - 1/10 -------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 13) (7 n + 168 n + 1028) b(n + 12) + 3/5 ---------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 14) (77 n + 1925 n + 11652) b(n + 13) + 1/10 ------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (11 n + 279 n + 1726) b(n + 14) - 1/2 -------------------------------- + b(n + 15) = 0 (n + 16) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 18, b(8) = 42, b(9) = 93, b(10) = 204, b(11) = 435, b(12) = 924, b(13) = 1940, b(14) = 4054, b(15) = 8408 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.89763 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 29.902, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 1]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 31 2 4 (n + 2) (41 n + 319 n + 578) a(n + 1) - ---------------------------------------- (n + 30) (n + 27) (n + 31) 2 2 (n + 3) (317 n + 3004 n + 6860) a(n + 2) + ------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (n + 4) (1367 n + 13817 n + 34668) a(n + 3) - -------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (n + 29) (253 n + 13627 n + 183000) a(n + 29) + 1/2 ---------------------------------------------- (n + 30) (n + 27) (n + 31) 40 (n + 4) (n + 2) (n + 1) a(n) + ------------------------------- + a(n + 31) (n + 30) (n + 27) (n + 31) 3 2 (11803 n + 885537 n + 22123486 n + 184038956) a(n + 26) - 1/2 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (2191 n + 169972 n + 4389786 n + 37740239) a(n + 27) + ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (622 n + 49893 n + 1332181 n + 11839112) a(n + 28) - ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (131861 n + 9321339 n + 219615346 n + 1724569932) a(n + 24) - 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (12632 n + 917991 n + 22223224 n + 179214461) a(n + 25) + --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (219841 n + 15260703 n + 352276382 n + 2704849992) a(n + 22) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (15697 n + 1089282 n + 25196863 n + 194289379) a(n + 23) + ------------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (59177 n + 1527188 n - 4593053 n - 233167334) a(n + 18) + 1/2 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (3778 n - 2054025 n - 83786608 n - 825023673) a(n + 19) - 1/3 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (124340 n + 10793937 n + 283816471 n + 2353755696) a(n + 20) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (202055 n + 14641098 n + 347899777 n + 2720492766) a(n + 21) + 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (2573 n + 39434 n + 200097 n + 336164) a(n + 4) + ------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (12125 n + 202479 n + 1131574 n + 2119536) a(n + 5) - 1/3 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (18085 n + 349251 n + 2339360 n + 5453028) a(n + 6) + 1/3 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57755 n + 1376061 n + 11647360 n + 34572504) a(n + 7) - 1/6 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (98803 n + 2892906 n + 29617499 n + 103973808) a(n + 8) + 1/6 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57501 n + 1952119 n + 22643618 n + 88549796) a(n + 9) - 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (285205 n + 10647015 n + 133966544 n + 564171432) a(n + 10) + 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (427376 n + 16996437 n + 226221259 n + 1004778456) a(n + 11) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (285347 n + 11873199 n + 164577457 n + 759517260) a(n + 12) + 1/3 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (676003 n + 29047284 n + 414029789 n + 1958127000) a(n + 13) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (710573 n + 31104420 n + 449225863 n + 2138936610) a(n + 14) + 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (55081 n + 2413767 n + 34546369 n + 160537831) a(n + 15) - ------------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (134017 n + 5713248 n + 77409053 n + 323486901) a(n + 16) + 2/3 ----------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (363461 n + 14107581 n + 155653018 n + 350454414) a(n + 17) - 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (49 n + 2718 n + 37589) a(n + 30) - 1/3 ---------------------------------- = 0 (n + 31) (n + 27) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 7, a(7) = 17, a(8) = 39, a(9) = 87, a(10) = 192, a(11) = 416, a(12) = 889, a(13) = 1882, a(14) = 3955, a(15) = 8264, a(16) = 17182, a(17) = 35567, a(18) = 73348, a(19) = 150781, a(20) = 309125, a(21) = 632284, a(22) = 1290635, a(23) = 2629730, a(24) = 5349666, a(25) = 10867530, a(26) = 22049244, a(27) = 44686323, a(28) = 90474100, a(29) = 183014997, a(30) = 369913867, a(31) = 747137182 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 27 2 (41 n + 197) (n + 3) (n + 2) b(n + 1) --------------------------------------- (n + 25) (n + 23) (n + 27) 2 (n + 3) (217 n + 2313 n + 5762) b(n + 2) - ----------------------------------------- + b(n + 27) (n + 25) (n + 23) (n + 27) 16 (n + 1) (n + 2) (n + 3) b(n) - ------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (10360 n + 331313 n + 3791049 n + 15344606) b(n + 10) + 3/4 ------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (24821 n + 840798 n + 10669351 n + 49540566) b(n + 11) - 1/4 -------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (2828 n + 74535 n + 1027717 n + 6823616) b(n + 12) + 3/4 ---------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (2194 n + 119839 n + 1778062 n + 7521599) b(n + 13) + 3/2 ----------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (35674 n + 1773303 n + 27557915 n + 135383760) b(n + 14) - 1/4 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (110819 n + 5453148 n + 87228913 n + 454571364) b(n + 15) + 1/8 ----------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (138590 n + 6837387 n + 111461521 n + 600287412) b(n + 16) - 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (150739 n + 7543161 n + 125408060 n + 692511078) b(n + 17) + 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (48450 n + 2492123 n + 42612987 n + 242190106) b(n + 18) - 3/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (123563 n + 6606198 n + 117348817 n + 692466282) b(n + 19) + 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (91061 n + 5096097 n + 94742608 n + 585021660) b(n + 20) - 1/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (56950 n + 3346083 n + 65332979 n + 423854358) b(n + 21) + 1/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (9835 n + 606504 n + 12435313 n + 84762926) b(n + 22) - 3/8 ------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (4088 n + 263937 n + 5667833 n + 40480170) b(n + 23) + 3/8 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (1948 n + 131211 n + 2940146 n + 21916752) b(n + 24) - 1/4 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (877 n + 61407 n + 1430474 n + 11086176) b(n + 25) + 1/8 ---------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (41 n + 2975 n + 71814 n + 576696) b(n + 26) - 3/8 ---------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (661 n + 12186 n + 68141 n + 119820) b(n + 3) + 1/2 ----------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1619 n + 43794 n + 322219 n + 719052) b(n + 4) - 1/4 ------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1055 n + 57921 n + 586642 n + 1666068) b(n + 5) + 1/4 -------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1411 n - 27732 n - 588409 n - 2283594) b(n + 6) + 1/4 -------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (7003 n + 106638 n + 414395 n + 61944) b(n + 7) - 1/4 ------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (16520 n + 396261 n + 3294553 n + 9566784) b(n + 8) + 1/4 ----------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (13340 n + 382281 n + 3853927 n + 13612188) b(n + 9) - 1/2 ------------------------------------------------------ = 0 (n + 25) (n + 23) (n + 27) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 43, b(9) = 96, b(10) = 211, b(11) = 457, b(12) = 977, b(13) = 2066, b(14) = 4335, b(15) = 9043, b(16) = 18773, b(17) = 38808, b(18) = 79926, b(19) = 164082, b(20) = 335935, b(21) = 686191, b(22) = 1398825, b(23) = 2846522, b(24) = 5783449, b(25) = 11734363, b(26) = 23779481, b(27) = 48136650 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7330 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.5702 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 62.063, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 1]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 1]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 1, 1]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 24 2 2 (9 n + 381 n + 4010) a(n + 23) 128 (n + 1) (n + 2) a(n + 1) - ------------------------------- - ----------------------------- (n + 24) (n + 20) (n + 20) (n + 24) (n + 23) 2 (n + 2) (5 n + 44 n + 90) a(n + 2) + 64/3 ----------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (n + 198 n + 1271 n + 2016) a(n + 3) - 32/3 -------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (121 n + 3957 n + 26918 n + 51576) a(n + 4) + 8/3 --------------------------------------------- (n + 20) (n + 24) (n + 23) n (n + 1) (n + 2) a(n) + 128/3 -------------------------- (n + 20) (n + 24) (n + 23) 3 2 (410 n + 11331 n + 84115 n + 187380) a(n + 5) - 8/3 ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 4 (89 n - 55 n - 6980 n - 18192) a(n + 6) - ------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4643 n + 113547 n + 932104 n + 2559744) a(n + 7) + 4/3 --------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (9379 n + 249095 n + 2183394 n + 6313392) a(n + 8) - ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4088 n + 43659 n - 354719 n - 3800544) a(n + 9) + 1/3 -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (64537 n + 2209815 n + 24899180 n + 92453784) a(n + 10) + 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (75946 n + 2486535 n + 26818235 n + 95084496) a(n + 11) - 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (19910 n + 400407 n + 886627 n - 12517440) a(n + 12) + 1/6 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (6258 n + 274251 n + 3910486 n + 18209561) a(n + 13) + ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (15359 n + 601886 n + 7752881 n + 32721250) a(n + 14) - 1/2 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (15259 n + 498897 n + 4779314 n + 11047158) a(n + 15) + 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3915 n + 199999 n + 3338804 n + 18243672) a(n + 16) + 1/2 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (13358 n + 622347 n + 9557149 n + 48264816) a(n + 17) - 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3194 n + 132441 n + 1710421 n + 6525726) a(n + 18) + 1/6 ----------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (339 n + 19763 n + 379686 n + 2404056) a(n + 19) + -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (1427 n + 79242 n + 1456507 n + 8850516) a(n + 20) - 1/6 ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (45 n + 2085 n + 28960 n + 105652) a(n + 21) + 1/2 ---------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 2 (12 n + 782 n + 16929 n + 121718) a(n + 22) + ----------------------------------------------- + a(n + 24) = 0 (n + 20) (n + 24) (n + 23) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 23, a(8) = 52, a(9) = 115, a(10) = 247, a(11) = 522, a(12) = 1094, a(13) = 2279, a(14) = 4718, a(15) = 9719, a(16) = 19947, a(17) = 40821, a(18) = 83326, a(19) = 169718, a(20) = 345044, a(21) = 700405, a(22) = 1419839, a(23) = 2874874, a(24) = 5815036 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[2, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 n (n + 1) (n + 2) b(n) (n + 6) (n + 2) (n + 1) b(n + 1) 128/5 -------------------------- + 128/5 -------------------------------- (n + 22) (n + 18) (n + 23) (n + 22) (n + 18) (n + 23) 2 (n + 2) (n + 40 n + 114) b(n + 2) + 64/5 ---------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (47 n + 696 n + 3067 n + 4200) b(n + 3) - 32/5 ----------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (89 n + 1749 n + 10102 n + 18360) b(n + 4) + 8/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (146 n + 2535 n + 14563 n + 27540) b(n + 5) + 24/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1135 n + 20307 n + 118808 n + 226272) b(n + 6) - 4/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (41 n - 1971 n - 35405 n - 137016) b(n + 7) + 8/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (761 n + 20961 n + 188354 n + 557392) b(n + 8) + 3/5 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (1246 n + 11163 n - 101365 n - 892320) b(n + 9) - 1/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (747 n + 39325 n + 564716 n + 2467240) b(n + 10) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (5164 n + 186213 n + 2277779 n + 9455376) b(n + 11) + 1/10 ----------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (429 n + 10722 n + 83205 n + 200240) b(n + 12) - 3/10 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4423 n + 192690 n + 2803421 n + 13632954) b(n + 13) - 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4681 n + 206508 n + 3065069 n + 15295650) b(n + 14) + 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (529 n + 23526 n + 345573 n + 1670800) b(n + 15) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (310 n + 16167 n + 284545 n + 1686224) b(n + 16) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1673 n + 86031 n + 1472158 n + 8377752) b(n + 17) + 1/10 ---------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (445 n + 23166 n + 398075 n + 2252814) b(n + 18) - 1/5 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (2 n + 369 n + 12229 n + 112830) b(n + 19) - 2/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (34 n + 2035 n + 40481 n + 267520) b(n + 20) + 3/5 ---------------------------------------------- (n + 22) (n + 18) (n + 23) 2 (8 n + 313 n + 3033) b(n + 21) - ------------------------------- + b(n + 22) = 0 (n + 23) (n + 18) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 10, b(7) = 22, b(8) = 48, b(9) = 105, b(10) = 225, b(11) = 474, b(12) = 990, b(13) = 2060, b(14) = 4266, b(15) = 8794, b(16) = 18061, b(17) = 36996, b(18) = 75606, b(19) = 154191, b(20) = 313884, b(21) = 637997, b(22) = 1295065 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.89761 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 44.949, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 1]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 8.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 2, 1]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 32 (n + 4) (n + 2) (n + 1) a(n) 16 (n + 2) (17 n + 121 n + 204) a(n + 1) - ------------------------------- + ----------------------------------------- (n + 19) (n + 23) (n + 22) (n + 19) (n + 23) (n + 22) 3 2 (391 n + 4395 n + 16166 n + 19512) a(n + 2) - 8/3 --------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (862 n + 11352 n + 49625 n + 72084) a(n + 3) + 8/3 ---------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (4337 n + 60585 n + 277480 n + 415056) a(n + 4) - 2/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (2891 n - 6453 n - 405446 n - 1577856) a(n + 5) + 1/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (24611 n + 789633 n + 7454140 n + 21949440) a(n + 6) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (20831 n + 642394 n + 6257419 n + 19631000) a(n + 7) - 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (45356 n + 1476255 n + 15452638 n + 52616220) a(n + 8) + 1/3 -------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (100997 n + 3466092 n + 38704831 n + 141585948) a(n + 9) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (15964 n + 561192 n + 6495337 n + 24817314) a(n + 10) + ------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (81329 n + 2812815 n + 32190844 n + 121865880) a(n + 11) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (63749 n + 2108124 n + 22585687 n + 77369856) a(n + 12) + 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (46979 n + 1504269 n + 14828500 n + 41540454) a(n + 13) - 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (10463 n + 338295 n + 3219492 n + 7431108) a(n + 14) + 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5445 n + 176200 n + 1562077 n + 2140506) a(n + 15) - 1/2 ----------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3548 n + 59139 n - 881945 n - 14741124) a(n + 16) + 1/6 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3997 n + 247923 n + 4968260 n + 32450070) a(n + 17) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5657 n + 313332 n + 5773981 n + 35400798) a(n + 18) - 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (1295 n + 72404 n + 1347469 n + 8345880) a(n + 19) + 1/2 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (567 n + 32650 n + 625459 n + 3985028) a(n + 20) - 1/2 -------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 2 (40 n + 2385 n + 47286 n + 311657) a(n + 21) + ------------------------------------------------ (n + 19) (n + 23) (n + 22) 2 (10 n + 398 n + 3939) a(n + 22) - 4/3 -------------------------------- + a(n + 23) = 0 (n + 23) (n + 19) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 23, a(8) = 52, a(9) = 116, a(10) = 253, a(11) = 538, a(12) = 1129, a(13) = 2355, a(14) = 4887, a(15) = 10086, a(16) = 20710, a(17) = 42368, a(18) = 86455, a(19) = 176039, a(20) = 357739, a(21) = 725714, a(22) = 1470089, a(23) = 2974515 Lemma , 8.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[2, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 48 (n + 4) (n + 2) (n + 1) b(n) 192 (n + 2) (2 n + 14 n + 23) b(n + 1) - ------------------------------- + --------------------------------------- (n + 20) (n + 18) (n + 22) (n + 20) (n + 18) (n + 22) 3 2 8 (172 n + 1893 n + 6800 n + 8016) b(n + 2) - --------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 4 (758 n + 10047 n + 44173 n + 64524) b(n + 3) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (4819 n + 76083 n + 400370 n + 702456) b(n + 4) - ------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (2016 n + 36691 n + 222177 n + 447772) b(n + 5) + --------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3943 n + 76485 n + 488416 n + 1024064) b(n + 6) - 3/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7399 n + 113904 n + 406553 n - 252312) b(n + 7) + 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (49 n + 20889 n + 354608 n + 1538492) b(n + 8) + -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7600 n + 378129 n + 5149847 n + 21333636) b(n + 9) - 1/2 ----------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23197 n + 1054791 n + 14420276 n + 62013648) b(n + 10) + 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (8553 n + 379750 n + 5301329 n + 23762652) b(n + 11) - 3/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (13181 n + 568932 n + 7982584 n + 36642720) b(n + 12) + 1/2 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (25949 n + 1095168 n + 15295663 n + 70754724) b(n + 13) - 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23053 n + 974373 n + 13692788 n + 63968616) b(n + 14) + 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (17657 n + 767250 n + 11085565 n + 53244564) b(n + 15) - 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (11491 n + 523299 n + 7924388 n + 39896412) b(n + 16) + 1/4 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3181 n + 153147 n + 2452565 n + 13063683) b(n + 17) - 1/2 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (2965 n + 150729 n + 2548952 n + 14338272) b(n + 18) + 1/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (553 n + 29505 n + 523577 n + 3090021) b(n + 19) - 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (25 n + 1392 n + 25771 n + 158636) b(n + 20) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (17 n + 984 n + 18931 n + 121052) b(n + 21) - 3/4 --------------------------------------------- + b(n + 22) = 0 (n + 20) (n + 18) (n + 22) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 58, b(9) = 128, b(10) = 278, b(11) = 592, b(12) = 1242, b(13) = 2582, b(14) = 5340, b(15) = 10994, b(16) = 22532, b(17) = 46006, b(18) = 93675, b(19) = 190338, b(20) = 386060, b(21) = 781790, b(22) = 1581005 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6348 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 43.892, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 9, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 10, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 1, 1]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 10.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 1, 1]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 31 2 (43 n + 2397 n + 33314) a(n + 30) (n + 4) (n + 3) (n + 2) a(n + 1) -1/3 ---------------------------------- - 64/3 -------------------------------- (n + 31) (n + 27) (n + 30) (n + 27) (n + 31) (n + 4) (n + 3) (23 n + 163) a(n + 2) + 16/3 ------------------------------------- (n + 30) (n + 27) (n + 31) (n + 1) (n + 2) (n + 3) a(n) - 64/3 ---------------------------- + a(n + 31) (n + 30) (n + 27) (n + 31) 3 2 (1409 n - 95427 n - 5862740 n - 67614084) a(n + 22) - 1/6 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (5267 n + 361139 n + 8177606 n + 61100732) a(n + 23) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (4666 n + 312575 n + 6917411 n + 50472820) a(n + 24) + 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2030 n + 127896 n + 2592775 n + 16607187) a(n + 25) - 1/3 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2684 n + 223065 n + 6136057 n + 55911834) a(n + 26) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (1171 n + 93805 n + 2501498 n + 22204418) a(n + 27) + 1/2 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (608 n + 49569 n + 1345471 n + 12157716) a(n + 28) - 1/2 ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (533 n + 44532 n + 1238587 n + 11466900) a(n + 29) + 1/6 ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (67 n + 1272 n + 7487 n + 13890) a(n + 3) - 8/3 ------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (5 n - 129 n - 1460 n - 3576) a(n + 4) + 8/3 ---------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (25 n + 232 n + 791 n + 1424) a(n + 5) - ------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 2 (92 n + 485 n - 8501 n - 51614) a(n + 6) - -------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (730 n + 1281 n - 132991 n - 772176) a(n + 7) + 2/3 ----------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (561 n + 1724 n - 102445 n - 652036) a(n + 8) - ----------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11437 n + 365094 n + 4243637 n + 17341860) a(n + 9) + 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (5881 n + 230203 n + 3145690 n + 14528428) a(n + 10) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2508 n + 98804 n + 1315565 n + 5856561) a(n + 11) + ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (13715 n + 481431 n + 4824412 n + 11500428) a(n + 12) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (509 n + 41055 n + 991233 n + 7171763) a(n + 13) - -------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (13801 n + 662043 n + 10515154 n + 55266536) a(n + 14) + 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 3 (3527 n + 169146 n + 2656959 n + 13666440) a(n + 15) - -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (17896 n + 815595 n + 12117173 n + 58311212) a(n + 16) + 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (27752 n + 968079 n + 8934121 n + 8888862) a(n + 17) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (3387 n + 318184 n + 7919065 n + 59025554) a(n + 18) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (24112 n + 1372359 n + 25734569 n + 158864166) a(n + 19) + 1/3 ---------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57881 n + 3092532 n + 54195601 n + 310181640) a(n + 20) - 1/6 ---------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11292 n + 575801 n + 9357891 n + 47254562) a(n + 21) + 1/2 ------------------------------------------------------- = 0 (n + 30) (n + 27) (n + 31) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 27, a(8) = 61, a(9) = 131, a(10) = 275, a(11) = 572, a(12) = 1186, a(13) = 2457, a(14) = 5083, a(15) = 10486, a(16) = 21550, a(17) = 44109, a(18) = 89952, a(19) = 182898, a(20) = 371071, a(21) = 751676, a(22) = 1520947, a(23) = 3074730, a(24) = 6210865, a(25) = 12536185, a(26) = 25284759, a(27) = 50962590, a(28) = 102652954, a(29) = 206657844, a(30) = 415839687, a(31) = 836416434 Lemma , 10.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[2, 2, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 14 4 (n + 1) (n + 2) b(n) 2 (n + 5) (n + 2) b(n + 1) ---------------------- - -------------------------- (n + 14) (n + 10) (n + 14) (n + 10) 2 2 (15 n + 111 n + 202) b(n + 2) (11 n + 195 n + 614) b(n + 3) - ------------------------------ - 1/2 ------------------------------ (n + 14) (n + 10) (n + 14) (n + 10) 2 2 (41 n + 651 n + 2192) b(n + 4) (17 n + 177 n + 497) b(n + 5) + 1/2 ------------------------------- + ------------------------------ (n + 14) (n + 10) (n + 14) (n + 10) 2 (50 n + 897 n + 3840) b(n + 6) - 1/2 ------------------------------- (n + 14) (n + 10) 2 (17 n + 492 n + 2745) b(n + 7) + 1/2 ------------------------------- (n + 14) (n + 10) 2 (56 n + 951 n + 3960) b(n + 8) - 1/2 ------------------------------- (n + 14) (n + 10) 2 (61 n + 963 n + 3616) b(n + 9) + 1/2 ------------------------------- (n + 14) (n + 10) 2 (27 n + 614 n + 3398) b(n + 10) + 1/2 -------------------------------- (n + 14) (n + 10) 2 (82 n + 1695 n + 8597) b(n + 11) - 1/2 --------------------------------- (n + 14) (n + 10) 2 (56 n + 1209 n + 6376) b(n + 12) + 1/2 --------------------------------- (n + 14) (n + 10) 2 (17 n + 387 n + 2146) b(n + 13) - 1/2 -------------------------------- + b(n + 14) = 0 (n + 14) (n + 10) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 57, b(9) = 120, b(10) = 249, b(11) = 516, b(12) = 1072, b(13) = 2230, b(14) = 4632 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.5701 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.7329 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 44.657, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 11, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 1, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 12, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 2, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 12.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 2, 2]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 3 2 (n - 1) (n - 3) (n + 1) a(n) 32 (13 n + 5 n - 58 n + 8) a(n + 1) -512/3 ---------------------------- - ------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 3 2 (68 n + 129 n - 77 n - 312) a(n + 2) + 16/3 -------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 8 (61 n + 276 n + 211 n + 304) a(n + 3) + ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (239 n + 1353 n + 1240 n + 6) a(n + 4) - 8/3 ---------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (327 n + 3225 n + 9392 n + 8372) a(n + 5) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (406 n + 8373 n + 48773 n + 83460) a(n + 6) + 1/3 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (4141 n + 57564 n + 228659 n + 246684) a(n + 7) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (1589 n + 27240 n + 150067 n + 275250) a(n + 8) + 1/3 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (556 n + 12879 n + 96668 n + 226989) a(n + 9) - 1/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (242 n + 5616 n + 41746 n + 100377) a(n + 10) - 2/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (234 n + 6360 n + 56059 n + 158767) a(n + 11) + ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (749 n + 23580 n + 243163 n + 815100) a(n + 12) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (16 n + 475 n + 4511 n + 13856) a(n + 13) + ------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 9420 n + 122771 n + 516186) a(n + 14) + 1/6 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 2 (227 n + 6051 n + 39190) a(n + 15) - 1/6 ----------------------------------- (n + 19) (n + 18) 3 2 (23 n + 994 n + 14247 n + 67728) a(n + 16) + 1/2 -------------------------------------------- (n + 15) (n + 19) (n + 18) 2 2 (11 n + 347 n + 2712) a(n + 17) (5 n + 164 n + 1331) a(n + 18) + 1/2 -------------------------------- - ------------------------------- (n + 18) (n + 15) (n + 19) (n + 15) + a(n + 19) = 0 Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 20, a(8) = 46, a(9) = 103, a(10) = 225, a(11) = 484, a(12) = 1027, a(13) = 2159, a(14) = 4504, a(15) = 9341, a(16) = 19277, a(17) = 39625, a(18) = 81182, a(19) = 165868 Lemma , 12.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[2, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 (n - 1) (n - 3) (n + 1) b(n) 32 (n - 2) (27 n + 57 n - 4) b(n + 1) 512/3 ---------------------------- + -------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 (n - 1) (106 n + 523 n + 264) b(n + 2) + 16/3 --------------------------------------- (n + 20) (n + 19) (n + 23) 2 n (809 n + 3750 n + 3001) b(n + 3) - 8/3 ----------------------------------- (n + 20) (n + 19) (n + 23) 2 (n + 1) (263 n + 2176 n + 3621) b(n + 4) - 16/3 ----------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2885 n + 17871 n + 2956 n - 36732) b(n + 5) + 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3596 n + 46275 n + 199033 n + 290196) b(n + 6) - 1/3 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (141 n + 12350 n + 123373 n + 268116) b(n + 7) + 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (18607 n + 313029 n + 1622054 n + 2707140) b(n + 8) + 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13639 n + 244392 n + 1325123 n + 2166930) b(n + 9) - 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (167 n - 4110 n - 119489 n - 543492) b(n + 10) - 1/3 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (2085 n + 46632 n + 317431 n + 654464) b(n + 11) + 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2869 n + 82765 n + 770364 n + 2297612) b(n + 12) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3163 n + 90240 n + 805451 n + 2194830) b(n + 13) + 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (305 n + 10793 n + 121000 n + 419206) b(n + 14) + ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1769 n + 60522 n + 655861 n + 2213700) b(n + 15) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (289 n + 11139 n + 140578 n + 583028) b(n + 16) + 1/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (41 n + 672 n - 11051 n - 184002) b(n + 17) - 1/6 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (50 n + 2193 n + 31339 n + 146010) b(n + 18) - 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11 n + 779 n + 17206 n + 121096) b(n + 19) - --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 2 (5 n + 277 n + 5086 n + 30938) b(n + 20) + -------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (8 n + 491 n + 10009 n + 67774) b(n + 21) + ------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (6 n + 251 n + 2614) b(n + 22) - ------------------------------- + b(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 73, b(9) = 164, b(10) = 357, b(11) = 762, b(12) = 1602, b(13) = 3332, b(14) = 6873, b(15) = 14090, b(16) = 28745, b(17) = 58422, b(18) = 118382, b(19) = 239313, b(20) = 482859, b(21) = 972776, b(22) = 1957357, b(23) = 3934549 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.099749 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 40.883, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 13, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[1, 1, 2, 2]}, than in, {[1, 1, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 13.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 1, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 32 (n + 4) (n + 2) (n + 1) a(n) 16 (n + 2) (9 n + 65 n + 108) a(n + 1) ------------------------------- - --------------------------------------- (n + 18) (n + 22) (n + 21) (n + 18) (n + 22) (n + 21) 3 2 (95 n + 1059 n + 3766 n + 4344) a(n + 2) + 8/3 ------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (58 n + 588 n + 1649 n + 948) a(n + 3) - 8/3 ---------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 2 (77 n + 1717 n + 11448 n + 23888) a(n + 4) - ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (399 n + 7615 n + 47330 n + 96288) a(n + 5) + --------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2779 n + 62073 n + 469100 n + 1196448) a(n + 6) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (915 n + 32374 n + 348995 n + 1187704) a(n + 7) + 1/2 ------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1265 n + 65070 n + 854836 n + 3347712) a(n + 8) - 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2039 n + 110352 n + 1527949 n + 6306432) a(n + 9) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (233 n + 7014 n + 43294 n - 50514) a(n + 10) - 1/3 ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2576 n + 128403 n + 1965073 n + 9540192) a(n + 11) - 1/6 ----------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (3815 n + 182034 n + 2771779 n + 13664040) a(n + 12) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (230 n + 36177 n + 859681 n + 5586654) a(n + 13) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (790 n + 30120 n + 374437 n + 1504222) a(n + 14) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (5555 n + 234558 n + 3278533 n + 15147966) a(n + 15) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (372 n + 16392 n + 239811 n + 1164842) a(n + 16) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (346 n + 17883 n + 305455 n + 1723402) a(n + 17) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1876 n + 97989 n + 1700417 n + 9798390) a(n + 18) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (385 n + 20949 n + 378914 n + 2277356) a(n + 19) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (197 n + 11163 n + 210262 n + 1316016) a(n + 20) + 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 2 (37 n + 1401 n + 13184) a(n + 21) - 1/3 ---------------------------------- + a(n + 22) = 0 (n + 22) (n + 18) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 31, a(8) = 73, a(9) = 162, a(10) = 345, a(11) = 716, a(12) = 1462, a(13) = 2959, a(14) = 5965, a(15) = 12013, a(16) = 24206, a(17) = 48822, a(18) = 98550, a(19) = 198999, a(20) = 401783, a(21) = 810802, a(22) = 1635017 Lemma , 13.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 1, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) b(n) 2 (11 n + 67 n + 84) b(n + 1) - ----------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (15 n + 109 n + 180) b(n + 2) (33 n + 413 n + 1116) b(n + 3) - ------------------------------ + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (29 n + 642 n + 2424) b(n + 4) (5 n + 217 n + 1050) b(n + 5) - 1/2 ------------------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (25 n + 323 n + 948) b(n + 6) (20 n + 31 n - 963) b(n + 7) - 1/2 ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (5 n + 199 n + 1332) b(n + 8) (11 n + 91 n - 144) b(n + 9) + ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (49 n + 887 n + 3882) b(n + 10) 7 (3 n + 59 n + 282) b(n + 11) - 1/2 -------------------------------- + ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (15 n + 313 n + 1584) b(n + 12) - 1/2 -------------------------------- + b(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 30, b(8) = 69, b(9) = 150, b(10) = 315, b(11) = 648, b(12) = 1318, b(13) = 2668 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.63472 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 31.997, seconds to generate The best bet against, [1, 1, 2, 1], is a member of, {[1, 1, 1, 2]}, 0.19943 and then your edge, if you have n rolls, is approximately, ------- 1/2 n The next best bet is a member of, {[2, 1, 1, 1]}, 0.19941 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[2, 2, 1, 1]}, 0.1628 and then your edge is approximately, ------ 1/2 n The next best bet is a member of, {[1, 1, 2, 2], [1, 2, 2, 2], [2, 2, 2, 1]}, 0.14102 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 2, 1, 1], [1, 2, 2, 1], [2, 1, 1, 2], [2, 1, 2, 2], [2, 2, 1, 2]}, and then your edge is exactly 0 The next best bet is a member of, {[2, 1, 2, 1]}, 0.1411 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[1, 2, 1, 2]}, 0.1628 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[2, 2, 2, 2]}, 0.598451 and then your edge is approximately, - -------- 1/2 n The next best bet is a member of, {[1, 1, 1, 1]}, 0.6911 and then your edge is approximately, - ------ 1/2 n ----------------------- This ends this chapter that took, 337.759, seconds to generate. ----------------------------------------------------------------- Chapter Number, 4 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 1, 2, 2], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 2 4 (2 n + 3) (n + 1) a(n) 2 (10 n + 41 n + 43) a(n + 1) - ------------------------ + ------------------------------ (n + 11) (n + 7) (n + 11) (n + 7) 2 2 4 (13 n + 88 n + 148) a(n + 2) (87 n + 739 n + 1560) a(n + 3) - ------------------------------- + ------------------------------- (n + 11) (n + 7) (n + 11) (n + 7) 2 (211 n + 2093 n + 5194) a(n + 4) - 1/2 --------------------------------- (n + 11) (n + 7) 2 (227 n + 2562 n + 7247) a(n + 5) + 1/2 --------------------------------- (n + 11) (n + 7) 2 2 (197 n + 2423 n + 7406) a(n + 6) (69 n + 907 n + 2910) a(n + 7) - 1/2 --------------------------------- + ------------------------------- (n + 11) (n + 7) (n + 11) (n + 7) 2 (89 n + 1271 n + 4366) a(n + 8) - 1/2 -------------------------------- (n + 11) (n + 7) 2 (47 n + 734 n + 2743) a(n + 9) + 1/2 ------------------------------- (n + 11) (n + 7) 2 (15 n + 253 n + 1018) a(n + 10) - 1/2 -------------------------------- + a(n + 11) = 0 (n + 11) (n + 7) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 28, a(8) = 66, a(9) = 146, a(10) = 313, a(11) = 656 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 29 2 4 (n + 5) (266 n + 1163 n + 1272) b(n + 1) - ------------------------------------------- + b(n + 29) (n + 25) (n + 29) (n + 27) 3 2 (67 n + 5271 n + 138002 n + 1202400) b(n + 28) - 1/4 ------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (352199 n + 18247836 n + 315139156 n + 1814082111) b(n + 17) + -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (93924 n + 5069919 n + 91232837 n + 547307936) b(n + 18) - ------------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 3 (68178 n + 3832134 n + 71800977 n + 448465171) b(n + 19) + ------------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (537319 n + 31437903 n + 613001822 n + 3983603568) b(n + 20) - 1/4 -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (26446 n + 1610219 n + 32662338 n + 220729643) b(n + 21) + ------------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (83515 n + 5290311 n + 111605126 n + 784107648) b(n + 22) - 1/2 ----------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (6451 n + 425014 n + 9322869 n + 68086094) b(n + 23) + -------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (5167 n + 353845 n + 8066648 n + 61216304) b(n + 24) - 3/2 ------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 3 (865 n + 61503 n + 1455650 n + 11468024) b(n + 25) + ------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (689 n + 50778 n + 1245655 n + 10171386) b(n + 26) - ---------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (134 n + 10215 n + 259183 n + 2188800) b(n + 27) + -------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 4 (676 n + 7737 n + 27989 n + 32718) b(n + 2) + ----------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 2 (2869 n + 36297 n + 148874 n + 199212) b(n + 3) - --------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (3681 n + 51641 n + 239430 n + 366968) b(n + 4) + --------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (17140 n + 256839 n + 1245935 n + 1926000) b(n + 5) - ----------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (21704 n + 324993 n + 1396621 n + 1273062) b(n + 6) + ----------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (7057 n + 83689 n - 3798 n - 1788726) b(n + 7) - -------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (34441 n - 797871 n - 22792462 n - 115654224) b(n + 8) + 1/4 -------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (21893 n + 1286268 n + 19252111 n + 85853892) b(n + 9) + -------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 2 (36947 n + 1623180 n + 22361806 n + 98782218) b(n + 10) - ----------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (147427 n + 6210516 n + 85399541 n + 385307148) b(n + 11) + ----------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (468061 n + 19957947 n + 281256320 n + 1311995316) b(n + 12) - 1/2 -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (106062 n + 4666512 n + 68166583 n + 330785299) b(n + 13) + ------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (764575 n + 34967781 n + 531985832 n + 2692870848) b(n + 14) - 1/2 -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (411469 n + 19610754 n + 311230412 n + 1644866859) b(n + 15) + -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (1599031 n + 79470147 n + 1316009786 n + 7261439544) b(n + 16) - 1/4 ---------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 120 (2 n + 3) (n + 4) (n + 1) b(n) + ---------------------------------- = 0 (n + 25) (n + 29) (n + 27) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 32, b(8) = 77, b(9) = 174, b(10) = 378, b(11) = 796, b(12) = 1640, b(13) = 3332, b(14) = 6707, b(15) = 13428, b(16) = 26824, b(17) = 53566, b(18) = 107055, b(19) = 214260, b(20) = 429467, b(21) = 861952, b(22) = 1731635, b(23) = 3480828, b(24) = 6998531, b(25) = 14070436, b(26) = 28281256, b(27) = 56823648, b(28) = 114124167, b(29) = 229110470 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.63079 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.3785 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 40.797, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 2.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 2, 1]}, then , {[1, 1, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 2 48 (n - 1) (n - 2) (n + 1) a(n) 24 (n - 1) (5 n + 4 n - 8) a(n + 1) ------------------------------- - ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 24 n (n - 15 n - 44) a(n + 2) + ------------------------------ (n + 9) (n + 7) (n + 11) 2 6 (n + 1) (17 n + 157 n + 334) a(n + 3) + ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 3 (n + 2) (20 n + 197 n + 499) a(n + 4) - ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 3) (100 n + 1083 n + 2798) a(n + 5) + 1/2 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 4) (329 n + 3421 n + 8190) a(n + 6) - 1/4 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 5) (31 n + 350 n + 926) a(n + 7) + 3/2 -------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 6) (28 n + 429 n + 1652) a(n + 8) - 1/2 --------------------------------------- (n + 9) (n + 7) (n + 11) 2 (7 n + 123 n + 532) a(n + 9) + 3/2 ----------------------------- (n + 11) (n + 9) 2 (n + 8) (23 n + 401 n + 1698) a(n + 10) - 1/4 ---------------------------------------- + a(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 58, a(9) = 126, a(10) = 268, a(11) = 562 Lemma , 2.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[2, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 2 48 (n - 1) (n - 2) (n + 1) b(n) 24 (n - 1) (13 n + 20 n - 8) b(n + 1) - ------------------------------- + -------------------------------------- (n + 15) (n + 13) (n + 11) (n + 15) (n + 13) (n + 11) 3 2 8 (101 n + 279 n + 10 n + 12) b(n + 2) - ---------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 2 (613 n + 3186 n + 4019 n + 1806) b(n + 3) + --------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1420 n + 11397 n + 26957 n + 20070) b(n + 4) - ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (2876 n + 30981 n + 102301 n + 104286) b(n + 5) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (5059 n + 68451 n + 293006 n + 400344) b(n + 6) - 1/4 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1967 n + 32841 n + 177064 n + 308310) b(n + 7) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1375 n + 27294 n + 175778 n + 364884) b(n + 8) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (285 n + 6571 n + 49486 n + 120990) b(n + 9) + 3/2 ---------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (493 n + 13020 n + 112778 n + 318696) b(n + 10) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (253 n + 7407 n + 71288 n + 224754) b(n + 11) + 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (109 n + 3510 n + 37382 n + 131556) b(n + 12) - 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (43 n + 1524 n + 17915 n + 69834) b(n + 13) + 1/2 --------------------------------------------- (n + 15) (n + 13) (n + 11) 2 (3 n + 38) (3 n + 75 n + 460) b(n + 14) - 3/4 ---------------------------------------- + b(n + 15) = 0 (n + 15) (n + 13) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 30, b(8) = 69, b(9) = 152, b(10) = 325, b(11) = 682, b(12) = 1415, b(13) = 2912, b(14) = 5958, b(15) = 12142 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.70526 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 25.865, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 2, 1, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 1, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 8 (n + 3) (n + 1) a(n) 2 (n + 4) (3 n + 7) a(n + 1) - ---------------------- - ---------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (17 n + 127 n + 226) a(n + 2) (11 n + 227 n + 748) a(n + 3) + ------------------------------ + 1/2 ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (83 n + 995 n + 2780) a(n + 4) (5 n + 175 n + 872) a(n + 5) - 1/4 ------------------------------- - 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (44 n + 653 n + 2374) a(n + 6) (7 n + 157 n + 822) a(n + 7) + 1/2 ------------------------------- - 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (23 n + 350 n + 1330) a(n + 8) (3 n + 8 n - 237) a(n + 9) - 1/2 ------------------------------- - 1/2 --------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (8 n + 109 n + 276) a(n + 10) + 1/2 ------------------------------ (n + 13) (n + 9) 2 (10 n + 211 n + 1083) a(n + 11) + 1/2 -------------------------------- (n + 13) (n + 9) 2 (19 n + 401 n + 2052) a(n + 12) - 1/4 -------------------------------- + a(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 7, a(7) = 17, a(8) = 39, a(9) = 86, a(10) = 189, a(11) = 408, a(12) = 868, a(13) = 1835 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 33 2 (n + 28) (18 n + 941 n + 12001) b(n + 30) ------------------------------------------ (n + 30) (n + 29) (n + 33) 2 (n + 3) (65 n + 669 n + 1732) b(n + 2) - 16/3 --------------------------------------- (n + 30) (n + 29) (n + 33) 2 (7 n + 431 n + 6620) b(n + 32) 64 (n + 4) (n + 3) (n + 2) b(n + 1) - ------------------------------- - ----------------------------------- (n + 33) (n + 30) (n + 30) (n + 29) (n + 33) (n + 1) (n + 2) (n + 3) b(n) + 64/3 ---------------------------- + b(n + 33) (n + 30) (n + 29) (n + 33) 3 2 (67 n + 6120 n + 186029 n + 1881816) b(n + 31) + 1/6 ------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (11120 n + 572733 n + 9495061 n + 50948760) b(n + 12) + 1/3 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (37795 n + 1580868 n + 21677873 n + 97399968) b(n + 13) - 1/6 --------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (5798 n + 340512 n + 6251734 n + 36722019) b(n + 14) - 2/3 ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (11355 n + 497904 n + 7225953 n + 34720196) b(n + 15) + 1/2 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (28177 n + 1443462 n + 24234953 n + 133528728) b(n + 16) + 1/6 ---------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (12379 n + 556902 n + 8324765 n + 41571546) b(n + 17) - 1/3 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (5588 n + 282845 n + 4653937 n + 24693084) b(n + 18) - ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (13165 n + 630888 n + 9899243 n + 50748696) b(n + 19) + 1/6 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (9901 n + 533307 n + 9345992 n + 52782168) b(n + 20) + 1/3 ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (343 n + 27765 n + 714818 n + 5873448) b(n + 21) - 1/3 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2903 n + 137619 n + 1914142 n + 6453642) b(n + 22) - 1/3 ----------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2851 n + 166890 n + 3109607 n + 18009588) b(n + 23) - 1/6 ------------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (1441 n + 44028 n - 272209 n - 11919144) b(n + 24) + 1/6 ---------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (59 n + 3244 n + 65273 n + 524304) b(n + 25) - 1/2 ---------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (115 n + 13320 n + 454415 n + 4827444) b(n + 26) + 1/3 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (319 n + 23984 n + 600633 n + 5013848) b(n + 27) + 1/2 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 2 (49 n + 3826 n + 99640 n + 866182) b(n + 28) - ------------------------------------------------ (n + 30) (n + 29) (n + 33) 3 2 (193 n + 16188 n + 450299 n + 4152768) b(n + 29) - 1/6 -------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 8 (n + 278 n + 2695 n + 6426) b(n + 3) - ---------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (761 n + 11448 n + 54721 n + 81822) b(n + 4) + 4/3 ---------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (247 n + 3852 n + 15722 n + 8331) b(n + 5) + 4/3 -------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (509 n - 9330 n - 196331 n - 740592) b(n + 6) - 1/3 ----------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (9391 n + 313200 n + 3386945 n + 11842176) b(n + 7) + 1/6 ----------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2435 n + 108000 n + 1210573 n + 3906660) b(n + 8) - 1/3 ---------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (24997 n + 941640 n + 11528759 n + 45957540) b(n + 9) - 1/6 ------------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (2605 n + 91980 n + 1433717 n + 8062158) b(n + 10) - 1/3 ---------------------------------------------------- (n + 30) (n + 29) (n + 33) 3 2 (17071 n + 698586 n + 9309011 n + 40493064) b(n + 11) + 1/3 ------------------------------------------------------- = 0 (n + 30) (n + 29) (n + 33) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 28, b(8) = 66, b(9) = 148, b(10) = 325, b(11) = 700, b(12) = 1484, b(13) = 3115, b(14) = 6483, b(15) = 13397, b(16) = 27540, b(17) = 56365, b(18) = 114934, b(19) = 233671, b(20) = 473895, b(21) = 959064, b(22) = 1937574, b(23) = 3908687, b(24) = 7875203, b(25) = 15850255, b(26) = 31872995, b(27) = 64044070, b(28) = 128603849, b(29) = 258100711, b(30) = 517749182, b(31) = 1038184358, b(32) = 2081036022, b(33) = 4170193503 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.8638 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.0575832 1/2 - --------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 48.184, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 1, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) a(n) 2 (11 n + 67 n + 84) a(n + 1) - ----------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (15 n + 109 n + 180) a(n + 2) (33 n + 413 n + 1116) a(n + 3) - ------------------------------ + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (29 n + 642 n + 2424) a(n + 4) (5 n + 217 n + 1050) a(n + 5) - 1/2 ------------------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (25 n + 323 n + 948) a(n + 6) (20 n + 31 n - 963) a(n + 7) - 1/2 ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (5 n + 199 n + 1332) a(n + 8) (11 n + 91 n - 144) a(n + 9) + ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (49 n + 887 n + 3882) a(n + 10) 7 (3 n + 59 n + 282) a(n + 11) - 1/2 -------------------------------- + ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (15 n + 313 n + 1584) a(n + 12) - 1/2 -------------------------------- + a(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 30, a(8) = 69, a(9) = 150, a(10) = 315, a(11) = 648, a(12) = 1318, a(13) = 2668 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 32 (n + 4) (n + 2) (n + 1) b(n) 16 (n + 2) (9 n + 65 n + 108) b(n + 1) ------------------------------- - --------------------------------------- (n + 18) (n + 22) (n + 21) (n + 18) (n + 22) (n + 21) 3 2 (95 n + 1059 n + 3766 n + 4344) b(n + 2) + 8/3 ------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (58 n + 588 n + 1649 n + 948) b(n + 3) - 8/3 ---------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 2 (77 n + 1717 n + 11448 n + 23888) b(n + 4) - ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (399 n + 7615 n + 47330 n + 96288) b(n + 5) + --------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2779 n + 62073 n + 469100 n + 1196448) b(n + 6) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (915 n + 32374 n + 348995 n + 1187704) b(n + 7) + 1/2 ------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1265 n + 65070 n + 854836 n + 3347712) b(n + 8) - 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2039 n + 110352 n + 1527949 n + 6306432) b(n + 9) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (233 n + 7014 n + 43294 n - 50514) b(n + 10) - 1/3 ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2576 n + 128403 n + 1965073 n + 9540192) b(n + 11) - 1/6 ----------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (3815 n + 182034 n + 2771779 n + 13664040) b(n + 12) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (230 n + 36177 n + 859681 n + 5586654) b(n + 13) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (790 n + 30120 n + 374437 n + 1504222) b(n + 14) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (5555 n + 234558 n + 3278533 n + 15147966) b(n + 15) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (372 n + 16392 n + 239811 n + 1164842) b(n + 16) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (346 n + 17883 n + 305455 n + 1723402) b(n + 17) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1876 n + 97989 n + 1700417 n + 9798390) b(n + 18) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (385 n + 20949 n + 378914 n + 2277356) b(n + 19) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (197 n + 11163 n + 210262 n + 1316016) b(n + 20) + 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 2 (37 n + 1401 n + 13184) b(n + 21) - 1/3 ---------------------------------- + b(n + 22) = 0 (n + 22) (n + 18) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 73, b(9) = 162, b(10) = 345, b(11) = 716, b(12) = 1462, b(13) = 2959, b(14) = 5965, b(15) = 12013, b(16) = 24206, b(17) = 48822, b(18) = 98550, b(19) = 198999, b(20) = 401783, b(21) = 810802, b(22) = 1635017 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.63472 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 31.900, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 7.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 1, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 14 4 (n + 1) (n + 2) a(n) 2 (n + 5) (n + 2) a(n + 1) ---------------------- - -------------------------- (n + 14) (n + 10) (n + 14) (n + 10) 2 2 (15 n + 111 n + 202) a(n + 2) (11 n + 195 n + 614) a(n + 3) - ------------------------------ - 1/2 ------------------------------ (n + 14) (n + 10) (n + 14) (n + 10) 2 2 (41 n + 651 n + 2192) a(n + 4) (17 n + 177 n + 497) a(n + 5) + 1/2 ------------------------------- + ------------------------------ (n + 14) (n + 10) (n + 14) (n + 10) 2 (50 n + 897 n + 3840) a(n + 6) - 1/2 ------------------------------- (n + 14) (n + 10) 2 (17 n + 492 n + 2745) a(n + 7) + 1/2 ------------------------------- (n + 14) (n + 10) 2 (56 n + 951 n + 3960) a(n + 8) - 1/2 ------------------------------- (n + 14) (n + 10) 2 (61 n + 963 n + 3616) a(n + 9) + 1/2 ------------------------------- (n + 14) (n + 10) 2 (27 n + 614 n + 3398) a(n + 10) + 1/2 -------------------------------- (n + 14) (n + 10) 2 (82 n + 1695 n + 8597) a(n + 11) - 1/2 --------------------------------- (n + 14) (n + 10) 2 (56 n + 1209 n + 6376) a(n + 12) + 1/2 --------------------------------- (n + 14) (n + 10) 2 (17 n + 387 n + 2146) a(n + 13) - 1/2 -------------------------------- + a(n + 14) = 0 (n + 14) (n + 10) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 57, a(9) = 120, a(10) = 249, a(11) = 516, a(12) = 1072, a(13) = 2230, a(14) = 4632 Lemma , 7.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 2, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 31 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) -64/3 ---------------------------- - 64/3 -------------------------------- (n + 30) (n + 27) (n + 31) (n + 30) (n + 27) (n + 31) (n + 4) (n + 3) (23 n + 163) b(n + 2) + 16/3 ------------------------------------- + b(n + 31) (n + 30) (n + 27) (n + 31) 3 2 (67 n + 1272 n + 7487 n + 13890) b(n + 3) - 8/3 ------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (5 n - 129 n - 1460 n - 3576) b(n + 4) + 8/3 ---------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (25 n + 232 n + 791 n + 1424) b(n + 5) - ------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 2 (92 n + 485 n - 8501 n - 51614) b(n + 6) - -------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (730 n + 1281 n - 132991 n - 772176) b(n + 7) + 2/3 ----------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (561 n + 1724 n - 102445 n - 652036) b(n + 8) - ----------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11437 n + 365094 n + 4243637 n + 17341860) b(n + 9) + 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 2 (43 n + 2397 n + 33314) b(n + 30) - 1/3 ---------------------------------- (n + 31) (n + 27) 3 2 (5881 n + 230203 n + 3145690 n + 14528428) b(n + 10) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2508 n + 98804 n + 1315565 n + 5856561) b(n + 11) + ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (13715 n + 481431 n + 4824412 n + 11500428) b(n + 12) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (509 n + 41055 n + 991233 n + 7171763) b(n + 13) - -------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (13801 n + 662043 n + 10515154 n + 55266536) b(n + 14) + 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 3 (3527 n + 169146 n + 2656959 n + 13666440) b(n + 15) - -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (17896 n + 815595 n + 12117173 n + 58311212) b(n + 16) + 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (27752 n + 968079 n + 8934121 n + 8888862) b(n + 17) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (3387 n + 318184 n + 7919065 n + 59025554) b(n + 18) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (24112 n + 1372359 n + 25734569 n + 158864166) b(n + 19) + 1/3 ---------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57881 n + 3092532 n + 54195601 n + 310181640) b(n + 20) - 1/6 ---------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11292 n + 575801 n + 9357891 n + 47254562) b(n + 21) + 1/2 ------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (1409 n - 95427 n - 5862740 n - 67614084) b(n + 22) - 1/6 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (5267 n + 361139 n + 8177606 n + 61100732) b(n + 23) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (4666 n + 312575 n + 6917411 n + 50472820) b(n + 24) + 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2030 n + 127896 n + 2592775 n + 16607187) b(n + 25) - 1/3 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2684 n + 223065 n + 6136057 n + 55911834) b(n + 26) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (1171 n + 93805 n + 2501498 n + 22204418) b(n + 27) + 1/2 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (608 n + 49569 n + 1345471 n + 12157716) b(n + 28) - 1/2 ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (533 n + 44532 n + 1238587 n + 11466900) b(n + 29) + 1/6 ---------------------------------------------------- = 0 (n + 30) (n + 27) (n + 31) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 27, b(8) = 61, b(9) = 131, b(10) = 275, b(11) = 572, b(12) = 1186, b(13) = 2457, b(14) = 5083, b(15) = 10486, b(16) = 21550, b(17) = 44109, b(18) = 89952, b(19) = 182898, b(20) = 371071, b(21) = 751676, b(22) = 1520947, b(23) = 3074730, b(24) = 6210865, b(25) = 12536185, b(26) = 25284759, b(27) = 50962590, b(28) = 102652954, b(29) = 206657844, b(30) = 415839687, b(31) = 836416434 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7329 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.5701 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 44.706, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 8.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 1, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) 32/5 ---------------------------- + 64/5 -------------------------------- (n + 11) (n + 16) (n + 15) (n + 11) (n + 16) (n + 15) 2 (n + 3) (8 n + 99 n + 265) a(n + 2) + 16/5 ------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 4) (n + 35 n + 114) a(n + 3) - 8/5 ---------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 5) (161 n + 2183 n + 7452) a(n + 4) - 2/5 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 6) (49 n + 543 n + 1178) a(n + 5) + 2/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 7) (7 n + 169 n + 894) a(n + 6) + 18/5 ------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 8) (25 n + 122 n - 1219) a(n + 7) - 3/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 9) (197 n + 681 n - 10208) a(n + 8) + 1/10 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 10) (95 n + 2569 n + 18810) a(n + 9) - 1/10 ------------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 355 n + 3838) a(n + 10) + 3/5 ----------------------------- (n + 16) (n + 15) 2 (n + 12) (113 n + 3339 n + 23152) a(n + 11) - 1/10 -------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 13) (7 n + 168 n + 1028) a(n + 12) + 3/5 ---------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 14) (77 n + 1925 n + 11652) a(n + 13) + 1/10 ------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (11 n + 279 n + 1726) a(n + 14) - 1/2 -------------------------------- + a(n + 15) = 0 (n + 16) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 18, a(8) = 42, a(9) = 93, a(10) = 204, a(11) = 435, a(12) = 924, a(13) = 1940, a(14) = 4054, a(15) = 8408 Lemma , 8.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 2, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) -32/3 ---------------------------- + 64/3 -------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (5 n + 36 n + 85) b(n + 2) + 16/3 ----------------------------------- (n + 13) (n + 17) (n + 16) 3 2 8 (8 n + 85 n + 299 n + 342) b(n + 3) - --------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (19 n + 984 n + 8621 n + 20928) b(n + 4) - 2/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (17 n + 195 n - 668 n - 7290) b(n + 5) + 2/3 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (203 n + 6354 n + 59527 n + 174384) b(n + 6) + 1/3 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (23 n + 1134 n + 6607 n - 6432) b(n + 7) - 1/6 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (547 n + 18831 n + 207812 n + 741912) b(n + 8) - 1/6 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (173 n + 5736 n + 60643 n + 206404) b(n + 9) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (10 n - 194 n - 8093 n - 51962) b(n + 10) - ------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (79 n + 3191 n + 41760 n + 178392) b(n + 11) - ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (275 n + 10206 n + 125812 n + 515310) b(n + 12) + 1/3 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (161 n + 5904 n + 72577 n + 299874) b(n + 13) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1917 n + 25794 n + 114272) b(n + 14) - 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1984 n + 27751 n + 128474) b(n + 15) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) b(n + 16) - ------------------------------- + b(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 45, b(9) = 101, b(10) = 222, b(11) = 477, b(12) = 1016, b(13) = 2139, b(14) = 4471, b(15) = 9279, b(16) = 19170, b(17) = 39432 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.89763 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 30.381, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 9, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 1]}, than in, {[1, 1, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win The best bet against, [1, 1, 2, 2], is a member of, {[1, 1, 1, 2], [1, 2, 2, 2], [2, 1, 1, 1], [2, 2, 1, 1], [2, 2, 2, 1]}, and then your edge, if you have n rolls, is exactly 0 The next best bet is a member of, {[1, 1, 2, 1], [2, 1, 2, 2]}, 0.14102 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 2, 1, 1], [2, 2, 1, 2]}, 0.1628 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[1, 2, 2, 1], [2, 1, 1, 2]}, 0.19943 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 2, 1, 2]}, 0.25229 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[2, 1, 2, 1]}, 0.28206 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 1, 1, 1], [2, 2, 2, 2]}, 0.8062168 and then your edge is approximately, - --------- 1/2 n ----------------------- This ends this chapter that took, 222.009, seconds to generate. ----------------------------------------------------------------- Chapter Number, 5 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 2, 1, 1], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 180 (n + 1) (n + 2) (n + 3) a(n) 90 (7 n + 24) (n + 3) (n + 2) a(n + 1) - -------------------------------- + -------------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 9 (n + 3) (49 n + 284 n + 262) a(n + 2) - ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (301 n + 4620 n + 23243 n + 38016) a(n + 3) - 3/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (n + 6) (301 n + 1657 n + 712) a(n + 4) + 3/2 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (5 n + 332 n + 2795 n + 5840) a(n + 5) + 9/2 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (196 n + 8592 n + 94925 n + 309540) a(n + 6) + ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (657 n + 25940 n + 277927 n + 901404) a(n + 7) - 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (10 n + 709 n - 1971 n - 62124) a(n + 8) + 1/2 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (492 n + 18831 n + 226801 n + 876098) a(n + 9) + 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (205 n + 7231 n + 82511 n + 306762) a(n + 10) - ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (32 n + 1511 n + 21647 n + 97322) a(n + 11) - 1/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (289 n + 10155 n + 117682 n + 448876) a(n + 12) + 1/2 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (168 n + 5893 n + 67995 n + 257178) a(n + 13) - 1/2 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (7 n + 472 n + 8779 n + 49522) a(n + 14) - 1/2 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (21 n + 897 n + 12698 n + 59512) a(n + 15) + -------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) a(n + 16) - ------------------------------- + a(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 7, a(7) = 16, a(8) = 37, a(9) = 85, a(10) = 186, a(11) = 400, a(12) = 852, a(13) = 1809, a(14) = 3810, a(15) = 7959, a(16) = 16538, a(17) = 34236 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 108 (n + 1) (n + 2) (n + 3) b(n) 18 (5 n - 8) (n + 3) (n + 2) b(n + 1) - -------------------------------- + ------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 9 (n + 3) (3 n - 136 n - 486) b(n + 2) - --------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (929 n + 16728 n + 97195 n + 180384) b(n + 3) + 3/2 ----------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2919 n + 61069 n + 404414 n + 859080) b(n + 4) - 3/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 3 (2503 n + 52430 n + 354549 n + 780372) b(n + 5) + --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11509 n + 196683 n + 912944 n + 716016) b(n + 6) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (6379 n + 274786 n + 3311107 n + 12129000) b(n + 7) - 1/2 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13231 n + 404682 n + 4028539 n + 13111554) b(n + 8) + ------------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (43571 n + 1340529 n + 13406095 n + 43661151) b(n + 9) - 1/3 -------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (14137 n + 473355 n + 5062871 n + 17353992) b(n + 10) + 1/3 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (31093 n + 962520 n + 9998447 n + 34970628) b(n + 11) + 1/6 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (36862 n + 1204185 n + 13159061 n + 48384168) b(n + 12) - 1/6 --------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3277 n + 112227 n + 1345416 n + 5760706) b(n + 13) + 1/2 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11153 n + 365859 n + 3603832 n + 9419928) b(n + 14) + 1/6 ------------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (13609 n + 475785 n + 5208548 n + 17116026) b(n + 15) - 1/6 ------------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2165 n + 81975 n + 999684 n + 3889716) b(n + 16) + 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1358 n + 60405 n + 906109 n + 4615698) b(n + 17) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (9 n + 1382 n + 39477 n + 314290) b(n + 18) + 1/2 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (293 n + 15630 n + 278767 n + 1664322) b(n + 19) + 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (133 n + 7577 n + 143668 n + 906828) b(n + 20) - 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (229 n + 13380 n + 260021 n + 1681086) b(n + 21) + 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (10 n + 411 n + 4198) b(n + 22) - -------------------------------- + b(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 59, b(9) = 133, b(10) = 293, b(11) = 632, b(12) = 1340, b(13) = 2818, b(14) = 5888, b(15) = 12224, b(16) = 25228, b(17) = 51823, b(18) = 106094, b(19) = 216560, b(20) = 440879, b(21) = 895460, b(22) = 1815261, b(23) = 3673951 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.8063 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.1152 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 39.754, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 2.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 24 2 128 (n + 1) (n + 2) a(n + 1) a(n + 24) - ----------------------------- (n + 20) (n + 24) (n + 23) 2 (n + 2) (5 n + 44 n + 90) a(n + 2) + 64/3 ----------------------------------- (n + 20) (n + 24) (n + 23) 2 (9 n + 381 n + 4010) a(n + 23) n (n + 1) (n + 2) a(n) - ------------------------------- + 128/3 -------------------------- (n + 24) (n + 20) (n + 20) (n + 24) (n + 23) 3 2 2 (12 n + 782 n + 16929 n + 121718) a(n + 22) + ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (410 n + 11331 n + 84115 n + 187380) a(n + 5) - 8/3 ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 4 (89 n - 55 n - 6980 n - 18192) a(n + 6) - ------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4643 n + 113547 n + 932104 n + 2559744) a(n + 7) + 4/3 --------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (9379 n + 249095 n + 2183394 n + 6313392) a(n + 8) - ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4088 n + 43659 n - 354719 n - 3800544) a(n + 9) + 1/3 -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (64537 n + 2209815 n + 24899180 n + 92453784) a(n + 10) + 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (75946 n + 2486535 n + 26818235 n + 95084496) a(n + 11) - 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (19910 n + 400407 n + 886627 n - 12517440) a(n + 12) + 1/6 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (6258 n + 274251 n + 3910486 n + 18209561) a(n + 13) + ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (15359 n + 601886 n + 7752881 n + 32721250) a(n + 14) - 1/2 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (15259 n + 498897 n + 4779314 n + 11047158) a(n + 15) + 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3915 n + 199999 n + 3338804 n + 18243672) a(n + 16) + 1/2 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (13358 n + 622347 n + 9557149 n + 48264816) a(n + 17) - 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3194 n + 132441 n + 1710421 n + 6525726) a(n + 18) + 1/6 ----------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (339 n + 19763 n + 379686 n + 2404056) a(n + 19) + -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (1427 n + 79242 n + 1456507 n + 8850516) a(n + 20) - 1/6 ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (45 n + 2085 n + 28960 n + 105652) a(n + 21) + 1/2 ---------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (n + 198 n + 1271 n + 2016) a(n + 3) - 32/3 -------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (121 n + 3957 n + 26918 n + 51576) a(n + 4) + 8/3 --------------------------------------------- = 0 (n + 20) (n + 24) (n + 23) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 23, a(8) = 52, a(9) = 115, a(10) = 247, a(11) = 522, a(12) = 1094, a(13) = 2279, a(14) = 4718, a(15) = 9719, a(16) = 19947, a(17) = 40821, a(18) = 83326, a(19) = 169718, a(20) = 345044, a(21) = 700405, a(22) = 1419839, a(23) = 2874874, a(24) = 5815036 Lemma , 2.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 n (n + 1) (n + 2) b(n) (n + 6) (n + 2) (n + 1) b(n + 1) 128/5 -------------------------- + 128/5 -------------------------------- (n + 22) (n + 18) (n + 23) (n + 22) (n + 18) (n + 23) 2 (n + 2) (n + 40 n + 114) b(n + 2) + 64/5 ---------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (47 n + 696 n + 3067 n + 4200) b(n + 3) - 32/5 ----------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (89 n + 1749 n + 10102 n + 18360) b(n + 4) + 8/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (146 n + 2535 n + 14563 n + 27540) b(n + 5) + 24/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1135 n + 20307 n + 118808 n + 226272) b(n + 6) - 4/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (41 n - 1971 n - 35405 n - 137016) b(n + 7) + 8/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (761 n + 20961 n + 188354 n + 557392) b(n + 8) + 3/5 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (1246 n + 11163 n - 101365 n - 892320) b(n + 9) - 1/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (747 n + 39325 n + 564716 n + 2467240) b(n + 10) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (5164 n + 186213 n + 2277779 n + 9455376) b(n + 11) + 1/10 ----------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (429 n + 10722 n + 83205 n + 200240) b(n + 12) - 3/10 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4423 n + 192690 n + 2803421 n + 13632954) b(n + 13) - 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4681 n + 206508 n + 3065069 n + 15295650) b(n + 14) + 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (529 n + 23526 n + 345573 n + 1670800) b(n + 15) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (310 n + 16167 n + 284545 n + 1686224) b(n + 16) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1673 n + 86031 n + 1472158 n + 8377752) b(n + 17) + 1/10 ---------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (445 n + 23166 n + 398075 n + 2252814) b(n + 18) - 1/5 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (2 n + 369 n + 12229 n + 112830) b(n + 19) - 2/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (34 n + 2035 n + 40481 n + 267520) b(n + 20) + 3/5 ---------------------------------------------- (n + 22) (n + 18) (n + 23) 2 (8 n + 313 n + 3033) b(n + 21) - ------------------------------- + b(n + 22) = 0 (n + 23) (n + 18) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 10, b(7) = 22, b(8) = 48, b(9) = 105, b(10) = 225, b(11) = 474, b(12) = 990, b(13) = 2060, b(14) = 4266, b(15) = 8794, b(16) = 18061, b(17) = 36996, b(18) = 75606, b(19) = 154191, b(20) = 313884, b(21) = 637997, b(22) = 1295065 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.89761 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 45.742, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 1]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 31 (n + 4) (n + 3) (n + 2) a(n + 1) a(n + 31) - 64/3 -------------------------------- (n + 30) (n + 27) (n + 31) (n + 4) (n + 3) (23 n + 163) a(n + 2) + 16/3 ------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (509 n + 41055 n + 991233 n + 7171763) a(n + 13) - -------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (13801 n + 662043 n + 10515154 n + 55266536) a(n + 14) + 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 3 (3527 n + 169146 n + 2656959 n + 13666440) a(n + 15) - -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (17896 n + 815595 n + 12117173 n + 58311212) a(n + 16) + 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (27752 n + 968079 n + 8934121 n + 8888862) a(n + 17) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (3387 n + 318184 n + 7919065 n + 59025554) a(n + 18) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (24112 n + 1372359 n + 25734569 n + 158864166) a(n + 19) + 1/3 ---------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57881 n + 3092532 n + 54195601 n + 310181640) a(n + 20) - 1/6 ---------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11292 n + 575801 n + 9357891 n + 47254562) a(n + 21) + 1/2 ------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (1409 n - 95427 n - 5862740 n - 67614084) a(n + 22) - 1/6 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (5267 n + 361139 n + 8177606 n + 61100732) a(n + 23) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (4666 n + 312575 n + 6917411 n + 50472820) a(n + 24) + 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2030 n + 127896 n + 2592775 n + 16607187) a(n + 25) - 1/3 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2684 n + 223065 n + 6136057 n + 55911834) a(n + 26) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (1171 n + 93805 n + 2501498 n + 22204418) a(n + 27) + 1/2 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (608 n + 49569 n + 1345471 n + 12157716) a(n + 28) - 1/2 ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (533 n + 44532 n + 1238587 n + 11466900) a(n + 29) + 1/6 ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (43 n + 2397 n + 33314) a(n + 30) - 1/3 ---------------------------------- (n + 31) (n + 27) (n + 1) (n + 2) (n + 3) a(n) - 64/3 ---------------------------- (n + 30) (n + 27) (n + 31) 3 2 (67 n + 1272 n + 7487 n + 13890) a(n + 3) - 8/3 ------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (5 n - 129 n - 1460 n - 3576) a(n + 4) + 8/3 ---------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (25 n + 232 n + 791 n + 1424) a(n + 5) - ------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 2 (92 n + 485 n - 8501 n - 51614) a(n + 6) - -------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (730 n + 1281 n - 132991 n - 772176) a(n + 7) + 2/3 ----------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (561 n + 1724 n - 102445 n - 652036) a(n + 8) - ----------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11437 n + 365094 n + 4243637 n + 17341860) a(n + 9) + 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (5881 n + 230203 n + 3145690 n + 14528428) a(n + 10) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (2508 n + 98804 n + 1315565 n + 5856561) a(n + 11) + ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (13715 n + 481431 n + 4824412 n + 11500428) a(n + 12) - 1/6 ------------------------------------------------------- = 0 (n + 30) (n + 27) (n + 31) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 27, a(8) = 61, a(9) = 131, a(10) = 275, a(11) = 572, a(12) = 1186, a(13) = 2457, a(14) = 5083, a(15) = 10486, a(16) = 21550, a(17) = 44109, a(18) = 89952, a(19) = 182898, a(20) = 371071, a(21) = 751676, a(22) = 1520947, a(23) = 3074730, a(24) = 6210865, a(25) = 12536185, a(26) = 25284759, a(27) = 50962590, a(28) = 102652954, a(29) = 206657844, a(30) = 415839687, a(31) = 836416434 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 1, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 14 4 (n + 1) (n + 2) b(n) 2 (n + 5) (n + 2) b(n + 1) ---------------------- - -------------------------- (n + 14) (n + 10) (n + 14) (n + 10) 2 2 (15 n + 111 n + 202) b(n + 2) (11 n + 195 n + 614) b(n + 3) - ------------------------------ - 1/2 ------------------------------ (n + 14) (n + 10) (n + 14) (n + 10) 2 2 (41 n + 651 n + 2192) b(n + 4) (17 n + 177 n + 497) b(n + 5) + 1/2 ------------------------------- + ------------------------------ (n + 14) (n + 10) (n + 14) (n + 10) 2 (50 n + 897 n + 3840) b(n + 6) - 1/2 ------------------------------- (n + 14) (n + 10) 2 (17 n + 492 n + 2745) b(n + 7) + 1/2 ------------------------------- (n + 14) (n + 10) 2 (56 n + 951 n + 3960) b(n + 8) - 1/2 ------------------------------- (n + 14) (n + 10) 2 (61 n + 963 n + 3616) b(n + 9) + 1/2 ------------------------------- (n + 14) (n + 10) 2 (27 n + 614 n + 3398) b(n + 10) + 1/2 -------------------------------- (n + 14) (n + 10) 2 (82 n + 1695 n + 8597) b(n + 11) - 1/2 --------------------------------- (n + 14) (n + 10) 2 (56 n + 1209 n + 6376) b(n + 12) + 1/2 --------------------------------- (n + 14) (n + 10) 2 (17 n + 387 n + 2146) b(n + 13) - 1/2 -------------------------------- + b(n + 14) = 0 (n + 14) (n + 10) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 57, b(9) = 120, b(10) = 249, b(11) = 516, b(12) = 1072, b(13) = 2230, b(14) = 4632 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.5701 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.7329 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 45.521, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 5.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 32 (n + 4) (n + 2) (n + 1) a(n) 16 (n + 2) (17 n + 121 n + 204) a(n + 1) - ------------------------------- + ----------------------------------------- (n + 19) (n + 23) (n + 22) (n + 19) (n + 23) (n + 22) 3 2 (391 n + 4395 n + 16166 n + 19512) a(n + 2) - 8/3 --------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (862 n + 11352 n + 49625 n + 72084) a(n + 3) + 8/3 ---------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (4337 n + 60585 n + 277480 n + 415056) a(n + 4) - 2/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (2891 n - 6453 n - 405446 n - 1577856) a(n + 5) + 1/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (24611 n + 789633 n + 7454140 n + 21949440) a(n + 6) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (20831 n + 642394 n + 6257419 n + 19631000) a(n + 7) - 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (45356 n + 1476255 n + 15452638 n + 52616220) a(n + 8) + 1/3 -------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (100997 n + 3466092 n + 38704831 n + 141585948) a(n + 9) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (15964 n + 561192 n + 6495337 n + 24817314) a(n + 10) + ------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (81329 n + 2812815 n + 32190844 n + 121865880) a(n + 11) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (63749 n + 2108124 n + 22585687 n + 77369856) a(n + 12) + 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (46979 n + 1504269 n + 14828500 n + 41540454) a(n + 13) - 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (10463 n + 338295 n + 3219492 n + 7431108) a(n + 14) + 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5445 n + 176200 n + 1562077 n + 2140506) a(n + 15) - 1/2 ----------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3548 n + 59139 n - 881945 n - 14741124) a(n + 16) + 1/6 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3997 n + 247923 n + 4968260 n + 32450070) a(n + 17) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5657 n + 313332 n + 5773981 n + 35400798) a(n + 18) - 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (1295 n + 72404 n + 1347469 n + 8345880) a(n + 19) + 1/2 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (567 n + 32650 n + 625459 n + 3985028) a(n + 20) - 1/2 -------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 2 (40 n + 2385 n + 47286 n + 311657) a(n + 21) + ------------------------------------------------ (n + 19) (n + 23) (n + 22) 2 (10 n + 398 n + 3939) a(n + 22) - 4/3 -------------------------------- + a(n + 23) = 0 (n + 23) (n + 19) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 23, a(8) = 52, a(9) = 116, a(10) = 253, a(11) = 538, a(12) = 1129, a(13) = 2355, a(14) = 4887, a(15) = 10086, a(16) = 20710, a(17) = 42368, a(18) = 86455, a(19) = 176039, a(20) = 357739, a(21) = 725714, a(22) = 1470089, a(23) = 2974515 Lemma , 5.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 48 (n + 4) (n + 2) (n + 1) b(n) 192 (n + 2) (2 n + 14 n + 23) b(n + 1) - ------------------------------- + --------------------------------------- (n + 20) (n + 18) (n + 22) (n + 20) (n + 18) (n + 22) 3 2 8 (172 n + 1893 n + 6800 n + 8016) b(n + 2) - --------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 4 (758 n + 10047 n + 44173 n + 64524) b(n + 3) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (4819 n + 76083 n + 400370 n + 702456) b(n + 4) - ------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (2016 n + 36691 n + 222177 n + 447772) b(n + 5) + --------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3943 n + 76485 n + 488416 n + 1024064) b(n + 6) - 3/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7399 n + 113904 n + 406553 n - 252312) b(n + 7) + 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (49 n + 20889 n + 354608 n + 1538492) b(n + 8) + -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7600 n + 378129 n + 5149847 n + 21333636) b(n + 9) - 1/2 ----------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23197 n + 1054791 n + 14420276 n + 62013648) b(n + 10) + 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (8553 n + 379750 n + 5301329 n + 23762652) b(n + 11) - 3/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (13181 n + 568932 n + 7982584 n + 36642720) b(n + 12) + 1/2 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (25949 n + 1095168 n + 15295663 n + 70754724) b(n + 13) - 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23053 n + 974373 n + 13692788 n + 63968616) b(n + 14) + 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (17657 n + 767250 n + 11085565 n + 53244564) b(n + 15) - 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (11491 n + 523299 n + 7924388 n + 39896412) b(n + 16) + 1/4 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3181 n + 153147 n + 2452565 n + 13063683) b(n + 17) - 1/2 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (2965 n + 150729 n + 2548952 n + 14338272) b(n + 18) + 1/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (553 n + 29505 n + 523577 n + 3090021) b(n + 19) - 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (25 n + 1392 n + 25771 n + 158636) b(n + 20) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (17 n + 984 n + 18931 n + 121052) b(n + 21) - 3/4 --------------------------------------------- + b(n + 22) = 0 (n + 20) (n + 18) (n + 22) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 58, b(9) = 128, b(10) = 278, b(11) = 592, b(12) = 1242, b(13) = 2582, b(14) = 5340, b(15) = 10994, b(16) = 22532, b(17) = 46006, b(18) = 93675, b(19) = 190338, b(20) = 386060, b(21) = 781790, b(22) = 1581005 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6348 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 45.190, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 1]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 1]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 7.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 1, 1]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) -32/3 ---------------------------- + 64/3 -------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (5 n + 36 n + 85) a(n + 2) + 16/3 ----------------------------------- (n + 13) (n + 17) (n + 16) 3 2 8 (8 n + 85 n + 299 n + 342) a(n + 3) - --------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (19 n + 984 n + 8621 n + 20928) a(n + 4) - 2/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (17 n + 195 n - 668 n - 7290) a(n + 5) + 2/3 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (203 n + 6354 n + 59527 n + 174384) a(n + 6) + 1/3 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (23 n + 1134 n + 6607 n - 6432) a(n + 7) - 1/6 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (547 n + 18831 n + 207812 n + 741912) a(n + 8) - 1/6 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (173 n + 5736 n + 60643 n + 206404) a(n + 9) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (10 n - 194 n - 8093 n - 51962) a(n + 10) - ------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (79 n + 3191 n + 41760 n + 178392) a(n + 11) - ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (275 n + 10206 n + 125812 n + 515310) a(n + 12) + 1/3 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (161 n + 5904 n + 72577 n + 299874) a(n + 13) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1917 n + 25794 n + 114272) a(n + 14) - 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1984 n + 27751 n + 128474) a(n + 15) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) a(n + 16) - ------------------------------- + a(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 45, a(9) = 101, a(10) = 222, a(11) = 477, a(12) = 1016, a(13) = 2139, a(14) = 4471, a(15) = 9279, a(16) = 19170, a(17) = 39432 Lemma , 7.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[2, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) 32/5 ---------------------------- + 64/5 -------------------------------- (n + 11) (n + 16) (n + 15) (n + 11) (n + 16) (n + 15) 2 (n + 3) (8 n + 99 n + 265) b(n + 2) + 16/5 ------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 4) (n + 35 n + 114) b(n + 3) - 8/5 ---------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 5) (161 n + 2183 n + 7452) b(n + 4) - 2/5 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 6) (49 n + 543 n + 1178) b(n + 5) + 2/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 7) (7 n + 169 n + 894) b(n + 6) + 18/5 ------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 8) (25 n + 122 n - 1219) b(n + 7) - 3/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 9) (197 n + 681 n - 10208) b(n + 8) + 1/10 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 10) (95 n + 2569 n + 18810) b(n + 9) - 1/10 ------------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 355 n + 3838) b(n + 10) + 3/5 ----------------------------- (n + 16) (n + 15) 2 (n + 12) (113 n + 3339 n + 23152) b(n + 11) - 1/10 -------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 13) (7 n + 168 n + 1028) b(n + 12) + 3/5 ---------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 14) (77 n + 1925 n + 11652) b(n + 13) + 1/10 ------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (11 n + 279 n + 1726) b(n + 14) - 1/2 -------------------------------- + b(n + 15) = 0 (n + 16) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 18, b(8) = 42, b(9) = 93, b(10) = 204, b(11) = 435, b(12) = 924, b(13) = 1940, b(14) = 4054, b(15) = 8408 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.89763 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 30.937, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 9, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 1]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 9.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 2, 1]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 31 2 (49 n + 2718 n + 37589) a(n + 30) -1/3 ---------------------------------- (n + 31) (n + 27) 2 (n + 29) (253 n + 13627 n + 183000) a(n + 29) + 1/2 ---------------------------------------------- (n + 30) (n + 27) (n + 31) 2 4 (n + 2) (41 n + 319 n + 578) a(n + 1) - ---------------------------------------- (n + 30) (n + 27) (n + 31) 2 2 (n + 3) (317 n + 3004 n + 6860) a(n + 2) + ------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (n + 4) (1367 n + 13817 n + 34668) a(n + 3) - -------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (2573 n + 39434 n + 200097 n + 336164) a(n + 4) + ------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (12125 n + 202479 n + 1131574 n + 2119536) a(n + 5) - 1/3 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (18085 n + 349251 n + 2339360 n + 5453028) a(n + 6) + 1/3 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57755 n + 1376061 n + 11647360 n + 34572504) a(n + 7) - 1/6 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (98803 n + 2892906 n + 29617499 n + 103973808) a(n + 8) + 1/6 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57501 n + 1952119 n + 22643618 n + 88549796) a(n + 9) - 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (285205 n + 10647015 n + 133966544 n + 564171432) a(n + 10) + 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (427376 n + 16996437 n + 226221259 n + 1004778456) a(n + 11) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (285347 n + 11873199 n + 164577457 n + 759517260) a(n + 12) + 1/3 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (676003 n + 29047284 n + 414029789 n + 1958127000) a(n + 13) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (710573 n + 31104420 n + 449225863 n + 2138936610) a(n + 14) + 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (55081 n + 2413767 n + 34546369 n + 160537831) a(n + 15) - ------------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (134017 n + 5713248 n + 77409053 n + 323486901) a(n + 16) + 2/3 ----------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (363461 n + 14107581 n + 155653018 n + 350454414) a(n + 17) - 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (59177 n + 1527188 n - 4593053 n - 233167334) a(n + 18) + 1/2 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (3778 n - 2054025 n - 83786608 n - 825023673) a(n + 19) - 1/3 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (124340 n + 10793937 n + 283816471 n + 2353755696) a(n + 20) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (202055 n + 14641098 n + 347899777 n + 2720492766) a(n + 21) + 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (219841 n + 15260703 n + 352276382 n + 2704849992) a(n + 22) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (15697 n + 1089282 n + 25196863 n + 194289379) a(n + 23) + ------------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (131861 n + 9321339 n + 219615346 n + 1724569932) a(n + 24) - 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (12632 n + 917991 n + 22223224 n + 179214461) a(n + 25) + --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11803 n + 885537 n + 22123486 n + 184038956) a(n + 26) - 1/2 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (2191 n + 169972 n + 4389786 n + 37740239) a(n + 27) + ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (622 n + 49893 n + 1332181 n + 11839112) a(n + 28) - ---------------------------------------------------- (n + 30) (n + 27) (n + 31) 40 (n + 4) (n + 2) (n + 1) a(n) + ------------------------------- + a(n + 31) = 0 (n + 30) (n + 27) (n + 31) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 7, a(7) = 17, a(8) = 39, a(9) = 87, a(10) = 192, a(11) = 416, a(12) = 889, a(13) = 1882, a(14) = 3955, a(15) = 8264, a(16) = 17182, a(17) = 35567, a(18) = 73348, a(19) = 150781, a(20) = 309125, a(21) = 632284, a(22) = 1290635, a(23) = 2629730, a(24) = 5349666, a(25) = 10867530, a(26) = 22049244, a(27) = 44686323, a(28) = 90474100, a(29) = 183014997, a(30) = 369913867, a(31) = 747137182 Lemma , 9.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[2, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 27 2 (n + 3) (217 n + 2313 n + 5762) b(n + 2) - ----------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (661 n + 12186 n + 68141 n + 119820) b(n + 3) + 1/2 ----------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1619 n + 43794 n + 322219 n + 719052) b(n + 4) - 1/4 ------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1055 n + 57921 n + 586642 n + 1666068) b(n + 5) + 1/4 -------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1411 n - 27732 n - 588409 n - 2283594) b(n + 6) + 1/4 -------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (7003 n + 106638 n + 414395 n + 61944) b(n + 7) - 1/4 ------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (16520 n + 396261 n + 3294553 n + 9566784) b(n + 8) + 1/4 ----------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (13340 n + 382281 n + 3853927 n + 13612188) b(n + 9) - 1/2 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (10360 n + 331313 n + 3791049 n + 15344606) b(n + 10) + 3/4 ------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (24821 n + 840798 n + 10669351 n + 49540566) b(n + 11) - 1/4 -------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (2828 n + 74535 n + 1027717 n + 6823616) b(n + 12) + 3/4 ---------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (2194 n + 119839 n + 1778062 n + 7521599) b(n + 13) + 3/2 ----------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (35674 n + 1773303 n + 27557915 n + 135383760) b(n + 14) - 1/4 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (110819 n + 5453148 n + 87228913 n + 454571364) b(n + 15) + 1/8 ----------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (138590 n + 6837387 n + 111461521 n + 600287412) b(n + 16) - 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (150739 n + 7543161 n + 125408060 n + 692511078) b(n + 17) + 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (48450 n + 2492123 n + 42612987 n + 242190106) b(n + 18) - 3/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (123563 n + 6606198 n + 117348817 n + 692466282) b(n + 19) + 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (91061 n + 5096097 n + 94742608 n + 585021660) b(n + 20) - 1/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (56950 n + 3346083 n + 65332979 n + 423854358) b(n + 21) + 1/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (9835 n + 606504 n + 12435313 n + 84762926) b(n + 22) - 3/8 ------------------------------------------------------- + b(n + 27) (n + 25) (n + 23) (n + 27) 16 (n + 1) (n + 2) (n + 3) b(n) - ------------------------------- (n + 25) (n + 23) (n + 27) 2 (41 n + 197) (n + 3) (n + 2) b(n + 1) + --------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (4088 n + 263937 n + 5667833 n + 40480170) b(n + 23) + 3/8 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (1948 n + 131211 n + 2940146 n + 21916752) b(n + 24) - 1/4 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (877 n + 61407 n + 1430474 n + 11086176) b(n + 25) + 1/8 ---------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (41 n + 2975 n + 71814 n + 576696) b(n + 26) - 3/8 ---------------------------------------------- = 0 (n + 25) (n + 23) (n + 27) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 43, b(9) = 96, b(10) = 211, b(11) = 457, b(12) = 977, b(13) = 2066, b(14) = 4335, b(15) = 9043, b(16) = 18773, b(17) = 38808, b(18) = 79926, b(19) = 164082, b(20) = 335935, b(21) = 686191, b(22) = 1398825, b(23) = 2846522, b(24) = 5783449, b(25) = 11734363, b(26) = 23779481, b(27) = 48136650 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7330 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.5702 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 62.471, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 10, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 1, 2, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 11, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 1, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 12, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 2, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 12.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 2, 2]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 3 2 (n - 1) (n - 3) (n + 1) a(n) 32 (13 n + 5 n - 58 n + 8) a(n + 1) -512/3 ---------------------------- - ------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 3 2 (68 n + 129 n - 77 n - 312) a(n + 2) + 16/3 -------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 8 (61 n + 276 n + 211 n + 304) a(n + 3) + ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (239 n + 1353 n + 1240 n + 6) a(n + 4) - 8/3 ---------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (327 n + 3225 n + 9392 n + 8372) a(n + 5) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (406 n + 8373 n + 48773 n + 83460) a(n + 6) + 1/3 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (4141 n + 57564 n + 228659 n + 246684) a(n + 7) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (1589 n + 27240 n + 150067 n + 275250) a(n + 8) + 1/3 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (556 n + 12879 n + 96668 n + 226989) a(n + 9) - 1/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (242 n + 5616 n + 41746 n + 100377) a(n + 10) - 2/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (234 n + 6360 n + 56059 n + 158767) a(n + 11) + ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (749 n + 23580 n + 243163 n + 815100) a(n + 12) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (16 n + 475 n + 4511 n + 13856) a(n + 13) + ------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 9420 n + 122771 n + 516186) a(n + 14) + 1/6 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 2 (227 n + 6051 n + 39190) a(n + 15) - 1/6 ----------------------------------- (n + 19) (n + 18) 3 2 (23 n + 994 n + 14247 n + 67728) a(n + 16) + 1/2 -------------------------------------------- (n + 15) (n + 19) (n + 18) 2 2 (11 n + 347 n + 2712) a(n + 17) (5 n + 164 n + 1331) a(n + 18) + 1/2 -------------------------------- - ------------------------------- (n + 18) (n + 15) (n + 19) (n + 15) + a(n + 19) = 0 Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 20, a(8) = 46, a(9) = 103, a(10) = 225, a(11) = 484, a(12) = 1027, a(13) = 2159, a(14) = 4504, a(15) = 9341, a(16) = 19277, a(17) = 39625, a(18) = 81182, a(19) = 165868 Lemma , 12.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[2, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 (n - 1) (n - 3) (n + 1) b(n) 32 (n - 2) (27 n + 57 n - 4) b(n + 1) 512/3 ---------------------------- + -------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 (n - 1) (106 n + 523 n + 264) b(n + 2) + 16/3 --------------------------------------- (n + 20) (n + 19) (n + 23) 2 n (809 n + 3750 n + 3001) b(n + 3) - 8/3 ----------------------------------- (n + 20) (n + 19) (n + 23) 2 (n + 1) (263 n + 2176 n + 3621) b(n + 4) - 16/3 ----------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2885 n + 17871 n + 2956 n - 36732) b(n + 5) + 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3596 n + 46275 n + 199033 n + 290196) b(n + 6) - 1/3 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (141 n + 12350 n + 123373 n + 268116) b(n + 7) + 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (18607 n + 313029 n + 1622054 n + 2707140) b(n + 8) + 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13639 n + 244392 n + 1325123 n + 2166930) b(n + 9) - 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (167 n - 4110 n - 119489 n - 543492) b(n + 10) - 1/3 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (2085 n + 46632 n + 317431 n + 654464) b(n + 11) + 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2869 n + 82765 n + 770364 n + 2297612) b(n + 12) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3163 n + 90240 n + 805451 n + 2194830) b(n + 13) + 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (305 n + 10793 n + 121000 n + 419206) b(n + 14) + ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1769 n + 60522 n + 655861 n + 2213700) b(n + 15) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (289 n + 11139 n + 140578 n + 583028) b(n + 16) + 1/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (41 n + 672 n - 11051 n - 184002) b(n + 17) - 1/6 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (50 n + 2193 n + 31339 n + 146010) b(n + 18) - 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11 n + 779 n + 17206 n + 121096) b(n + 19) - --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 2 (5 n + 277 n + 5086 n + 30938) b(n + 20) + -------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (8 n + 491 n + 10009 n + 67774) b(n + 21) + ------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (6 n + 251 n + 2614) b(n + 22) - ------------------------------- + b(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 73, b(9) = 164, b(10) = 357, b(11) = 762, b(12) = 1602, b(13) = 3332, b(14) = 6873, b(15) = 14090, b(16) = 28745, b(17) = 58422, b(18) = 118382, b(19) = 239313, b(20) = 482859, b(21) = 972776, b(22) = 1957357, b(23) = 3934549 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.099749 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 41.594, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 13, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[1, 2, 2, 2]}, than in, {[1, 2, 1, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 13.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[1, 2, 1, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 32 (n + 4) (n + 2) (n + 1) a(n) 16 (n + 2) (9 n + 65 n + 108) a(n + 1) ------------------------------- - --------------------------------------- (n + 18) (n + 22) (n + 21) (n + 18) (n + 22) (n + 21) 3 2 (95 n + 1059 n + 3766 n + 4344) a(n + 2) + 8/3 ------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (58 n + 588 n + 1649 n + 948) a(n + 3) - 8/3 ---------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 2 (77 n + 1717 n + 11448 n + 23888) a(n + 4) - ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (399 n + 7615 n + 47330 n + 96288) a(n + 5) + --------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2779 n + 62073 n + 469100 n + 1196448) a(n + 6) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (915 n + 32374 n + 348995 n + 1187704) a(n + 7) + 1/2 ------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1265 n + 65070 n + 854836 n + 3347712) a(n + 8) - 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2039 n + 110352 n + 1527949 n + 6306432) a(n + 9) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (233 n + 7014 n + 43294 n - 50514) a(n + 10) - 1/3 ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2576 n + 128403 n + 1965073 n + 9540192) a(n + 11) - 1/6 ----------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (3815 n + 182034 n + 2771779 n + 13664040) a(n + 12) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (230 n + 36177 n + 859681 n + 5586654) a(n + 13) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (790 n + 30120 n + 374437 n + 1504222) a(n + 14) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (5555 n + 234558 n + 3278533 n + 15147966) a(n + 15) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (372 n + 16392 n + 239811 n + 1164842) a(n + 16) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (346 n + 17883 n + 305455 n + 1723402) a(n + 17) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1876 n + 97989 n + 1700417 n + 9798390) a(n + 18) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (385 n + 20949 n + 378914 n + 2277356) a(n + 19) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (197 n + 11163 n + 210262 n + 1316016) a(n + 20) + 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 2 (37 n + 1401 n + 13184) a(n + 21) - 1/3 ---------------------------------- + a(n + 22) = 0 (n + 22) (n + 18) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 31, a(8) = 73, a(9) = 162, a(10) = 345, a(11) = 716, a(12) = 1462, a(13) = 2959, a(14) = 5965, a(15) = 12013, a(16) = 24206, a(17) = 48822, a(18) = 98550, a(19) = 198999, a(20) = 401783, a(21) = 810802, a(22) = 1635017 Lemma , 13.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) b(n) 2 (11 n + 67 n + 84) b(n + 1) - ----------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (15 n + 109 n + 180) b(n + 2) (33 n + 413 n + 1116) b(n + 3) - ------------------------------ + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (29 n + 642 n + 2424) b(n + 4) (5 n + 217 n + 1050) b(n + 5) - 1/2 ------------------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (25 n + 323 n + 948) b(n + 6) (20 n + 31 n - 963) b(n + 7) - 1/2 ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (5 n + 199 n + 1332) b(n + 8) (11 n + 91 n - 144) b(n + 9) + ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (49 n + 887 n + 3882) b(n + 10) 7 (3 n + 59 n + 282) b(n + 11) - 1/2 -------------------------------- + ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (15 n + 313 n + 1584) b(n + 12) - 1/2 -------------------------------- + b(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 30, b(8) = 69, b(9) = 150, b(10) = 315, b(11) = 648, b(12) = 1318, b(13) = 2668 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.63472 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 32.509, seconds to generate The best bet against, [1, 2, 1, 1], is a member of, {[2, 1, 1, 1]}, 0.19943 and then your edge, if you have n rolls, is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 1, 2]}, 0.19941 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 2, 2]}, 0.1628 and then your edge is approximately, ------ 1/2 n The next best bet is a member of, {[1, 2, 2, 2], [2, 2, 1, 1], [2, 2, 2, 1]}, 0.14102 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 2, 1], [1, 2, 2, 1], [2, 1, 1, 2], [2, 1, 2, 2], [2, 2, 1, 2]}, and then your edge is exactly 0 The next best bet is a member of, {[1, 2, 1, 2]}, 0.1411 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[2, 1, 2, 1]}, 0.1628 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[2, 2, 2, 2]}, 0.598451 and then your edge is approximately, - -------- 1/2 n The next best bet is a member of, {[1, 1, 1, 1]}, 0.6911 and then your edge is approximately, - ------ 1/2 n ----------------------- This ends this chapter that took, 344.040, seconds to generate. ----------------------------------------------------------------- Chapter Number, 6 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 2, 1, 2], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 2]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 2, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 29 120 (2 n + 3) (n + 4) (n + 1) a(n) a(n + 29) + ---------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (1599031 n + 79470147 n + 1316009786 n + 7261439544) a(n + 16) - 1/4 ---------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (352199 n + 18247836 n + 315139156 n + 1814082111) a(n + 17) + -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (93924 n + 5069919 n + 91232837 n + 547307936) a(n + 18) - ------------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 3 (68178 n + 3832134 n + 71800977 n + 448465171) a(n + 19) + ------------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (537319 n + 31437903 n + 613001822 n + 3983603568) a(n + 20) - 1/4 -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (26446 n + 1610219 n + 32662338 n + 220729643) a(n + 21) + ------------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (83515 n + 5290311 n + 111605126 n + 784107648) a(n + 22) - 1/2 ----------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (6451 n + 425014 n + 9322869 n + 68086094) a(n + 23) + -------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (5167 n + 353845 n + 8066648 n + 61216304) a(n + 24) - 3/2 ------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 3 (865 n + 61503 n + 1455650 n + 11468024) a(n + 25) + ------------------------------------------------------ (n + 25) (n + 29) (n + 27) 3 2 (689 n + 50778 n + 1245655 n + 10171386) a(n + 26) - ---------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (134 n + 10215 n + 259183 n + 2188800) a(n + 27) + -------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (67 n + 5271 n + 138002 n + 1202400) a(n + 28) - 1/4 ------------------------------------------------ (n + 25) (n + 29) (n + 27) 2 4 (n + 5) (266 n + 1163 n + 1272) a(n + 1) - ------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 4 (676 n + 7737 n + 27989 n + 32718) a(n + 2) + ----------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 2 (2869 n + 36297 n + 148874 n + 199212) a(n + 3) - --------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (3681 n + 51641 n + 239430 n + 366968) a(n + 4) + --------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (17140 n + 256839 n + 1245935 n + 1926000) a(n + 5) - ----------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (21704 n + 324993 n + 1396621 n + 1273062) a(n + 6) + ----------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (7057 n + 83689 n - 3798 n - 1788726) a(n + 7) - -------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (34441 n - 797871 n - 22792462 n - 115654224) a(n + 8) + 1/4 -------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (21893 n + 1286268 n + 19252111 n + 85853892) a(n + 9) + -------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 2 (36947 n + 1623180 n + 22361806 n + 98782218) a(n + 10) - ----------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (147427 n + 6210516 n + 85399541 n + 385307148) a(n + 11) + ----------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (468061 n + 19957947 n + 281256320 n + 1311995316) a(n + 12) - 1/2 -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 3 (106062 n + 4666512 n + 68166583 n + 330785299) a(n + 13) + ------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (764575 n + 34967781 n + 531985832 n + 2692870848) a(n + 14) - 1/2 -------------------------------------------------------------- (n + 25) (n + 29) (n + 27) 3 2 (411469 n + 19610754 n + 311230412 n + 1644866859) a(n + 15) + -------------------------------------------------------------- = 0 (n + 25) (n + 29) (n + 27) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 32, a(8) = 77, a(9) = 174, a(10) = 378, a(11) = 796, a(12) = 1640, a(13) = 3332, a(14) = 6707, a(15) = 13428, a(16) = 26824, a(17) = 53566, a(18) = 107055, a(19) = 214260, a(20) = 429467, a(21) = 861952, a(22) = 1731635, a(23) = 3480828, a(24) = 6998531, a(25) = 14070436, a(26) = 28281256, a(27) = 56823648, a(28) = 114124167, a(29) = 229110470 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 2 4 (2 n + 3) (n + 1) b(n) 2 (10 n + 41 n + 43) b(n + 1) - ------------------------ + ------------------------------ (n + 11) (n + 7) (n + 11) (n + 7) 2 2 4 (13 n + 88 n + 148) b(n + 2) (87 n + 739 n + 1560) b(n + 3) - ------------------------------- + ------------------------------- (n + 11) (n + 7) (n + 11) (n + 7) 2 (211 n + 2093 n + 5194) b(n + 4) - 1/2 --------------------------------- (n + 11) (n + 7) 2 (227 n + 2562 n + 7247) b(n + 5) + 1/2 --------------------------------- (n + 11) (n + 7) 2 2 (197 n + 2423 n + 7406) b(n + 6) (69 n + 907 n + 2910) b(n + 7) - 1/2 --------------------------------- + ------------------------------- (n + 11) (n + 7) (n + 11) (n + 7) 2 (89 n + 1271 n + 4366) b(n + 8) - 1/2 -------------------------------- (n + 11) (n + 7) 2 (47 n + 734 n + 2743) b(n + 9) + 1/2 ------------------------------- (n + 11) (n + 7) 2 (15 n + 253 n + 1018) b(n + 10) - 1/2 -------------------------------- + b(n + 11) = 0 (n + 11) (n + 7) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 28, b(8) = 66, b(9) = 146, b(10) = 313, b(11) = 656 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.3785 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.63079 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 41.545, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 1]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 3.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 28 192 (n - 2) (n + 2) (n + 1) a(n) - -------------------------------- (n + 24) (n + 28) (n + 26) 3 2 8 (137 n + 135 n - 1076 n - 864) a(n + 2) - ------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 12 (33 n - 651 n - 3404 n - 1888) a(n + 3) + -------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 6 (133 n + 2383 n + 8758 n + 3768) a(n + 4) + --------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 3 (881 n + 17529 n + 102002 n + 172320) a(n + 5) - -------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (4643 n + 116301 n + 827704 n + 1702064) a(n + 6) + 3/2 --------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (24365 n + 588969 n + 4368488 n + 9846304) a(n + 7) - 3/4 ----------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (246851 n + 6359853 n + 52278442 n + 135988176) a(n + 8) + 1/8 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (145537 n + 4248183 n + 39717380 n + 118235304) a(n + 9) - 1/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (123979 n + 3888869 n + 39457580 n + 128934080) a(n + 10) + 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (149337 n + 4910546 n + 52980149 n + 186944708) a(n + 11) - 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 2 48 (n + 2) (17 n + 15 n - 48) a(n + 1) + --------------------------------------- + a(n + 28) (n + 24) (n + 28) (n + 26) 3 2 (140573 n + 4957283 n + 57681086 n + 220857024) a(n + 12) + 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (67491 n + 2543602 n + 31702581 n + 130462510) a(n + 13) - 3/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (126101 n + 4992909 n + 65546788 n + 285136400) a(n + 14) + 3/8 ----------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (292331 n + 12268212 n + 171003181 n + 791531604) a(n + 15) - 1/8 ------------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (224545 n + 10049115 n + 149350280 n + 737012268) a(n + 16) + 1/8 ------------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (27888 n + 1315390 n + 20600541 n + 107124017) a(n + 17) - 3/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (35309 n + 1760115 n + 29146500 n + 160327752) a(n + 18) + 3/8 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (21759 n + 1151150 n + 20227143 n + 118023264) a(n + 19) - 3/8 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (19580 n + 1090473 n + 20172862 n + 123933744) a(n + 20) + 1/4 ---------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (10061 n + 590118 n + 11500873 n + 74456964) a(n + 21) - 1/4 -------------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (1624 n + 100459 n + 2064841 n + 14097640) a(n + 22) + 3/4 ------------------------------------------------------ (n + 24) (n + 28) (n + 26) 3 2 (776 n + 50292 n + 1083505 n + 7758289) a(n + 23) - 3/4 --------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (627 n + 42463 n + 956416 n + 7163220) a(n + 24) + 3/8 -------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (108 n + 7651 n + 180316 n + 1413585) a(n + 25) - 3/4 ------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (221 n + 16323 n + 401218 n + 3281784) a(n + 26) + 1/8 -------------------------------------------------- (n + 24) (n + 28) (n + 26) 3 2 (61 n + 4650 n + 117959 n + 995754) a(n + 27) - 1/8 ----------------------------------------------- = 0 (n + 24) (n + 28) (n + 26) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 44, a(9) = 99, a(10) = 216, a(11) = 466, a(12) = 994, a(13) = 2095, a(14) = 4386, a(15) = 9132, a(16) = 18905, a(17) = 38972, a(18) = 80083, a(19) = 164053, a(20) = 335175, a(21) = 683373, a(22) = 1390709, a(23) = 2825383, a(24) = 5732001, a(25) = 11614650, a(26) = 23508295, a(27) = 47534859, a(28) = 96036524 Lemma , 3.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 34 2 (n + 2) (2 n - 7 n - 3) b(n + 1) -1024/3 --------------------------------- (n + 30) (n + 34) (n + 31) 2 (5 n + 149) (13 n + 777 n + 11596) b(n + 31) - 1/2 --------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (671683 n + 34017654 n + 570293099 n + 3165613764) b(n + 19) + 1/6 -------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (225989 n + 11902635 n + 206915134 n + 1186535592) b(n + 20) - 1/3 -------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (61775 n + 3363747 n + 60279037 n + 354926412) b(n + 21) + 2/3 ---------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (148669 n + 8583561 n + 163422170 n + 1024805400) b(n + 22) - 1/6 ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (37105 n + 2186004 n + 42187625 n + 265650528) b(n + 23) + 1/3 ---------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (9081 n + 537089 n + 10269924 n + 62726140) b(n + 24) - 1/2 ------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4321 n + 270334 n + 5492839 n + 35917878) b(n + 25) + 1/2 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (871 n + 43517 n + 538200 n - 100288) b(n + 26) - 1/2 ------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (455 n + 42942 n + 1309707 n + 13008736) b(n + 27) - 1/2 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (127 n + 11570 n + 346983 n + 3431320) b(n + 28) + -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (135 n + 11884 n + 347561 n + 3377250) b(n + 29) - -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (195 n + 17003 n + 493770 n + 4775540) b(n + 30) + 1/2 -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (27 n + 2507 n + 77524 n + 798392) b(n + 32) + 1/2 ---------------------------------------------- (n + 30) (n + 34) (n + 31) 2 (6 n + 383 n + 6101) b(n + 33) - ------------------------------- (n + 34) (n + 31) 3 2 (514 n + 8733 n + 44492 n + 68445) b(n + 4) - 128/3 --------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1897 n + 36201 n + 212672 n + 387678) b(n + 5) + 64/3 ------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (8275 n + 162849 n + 1036427 n + 2125953) b(n + 6) - 32/3 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (25163 n + 588849 n + 4507570 n + 11257410) b(n + 7) + 16/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 4 (46913 n + 1176980 n + 9696507 n + 26200448) b(n + 8) - --------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (218297 n + 5999796 n + 54649183 n + 164718012) b(n + 9) + 4/3 ---------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (113102 n + 3395283 n + 33850909 n + 111989886) b(n + 10) - 8/3 ----------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 2 (190329 n + 6149140 n + 65959175 n + 234800892) b(n + 11) + ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (416799 n + 14306784 n + 163382805 n + 620933612) b(n + 12) - ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1126037 n + 41435904 n + 507282943 n + 2066779500) b(n + 13) + 1/3 --------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1180597 n + 46215282 n + 601105265 n + 2599177512) b(n + 14) - 1/3 --------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2007365 n + 82194462 n + 1117457101 n + 5048723712) b(n + 15) + 1/6 ---------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (270460 n + 11797763 n + 170884771 n + 822548462) b(n + 16) - ------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1375753 n + 63085542 n + 958637963 n + 4830201690) b(n + 17) + 1/6 --------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (315727 n + 15051437 n + 237325124 n + 1238045088) b(n + 18) - 1/2 -------------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (n + 123 n + 461 n + 327) b(n + 2) - 512/3 ------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 256 (17 n + 221 n + 760 n + 698) b(n + 3) + ------------------------------------------- + b(n + 34) (n + 30) (n + 34) (n + 31) 1024 (n - 1) (n + 2) (n + 1) b(n) + --------------------------------- = 0 (n + 30) (n + 34) (n + 31) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 27, b(8) = 63, b(9) = 142, b(10) = 310, b(11) = 665, b(12) = 1411, b(13) = 2958, b(14) = 6148, b(15) = 12708, b(16) = 26126, b(17) = 53466, b(18) = 109063, b(19) = 221850, b(20) = 450129, b(21) = 911492, b(22) = 1842745, b(23) = 3719991, b(24) = 7500406, b(25) = 15107538, b(26) = 30403345, b(27) = 61138743, b(28) = 122866932, b(29) = 246783216, b(30) = 495434834, b(31) = 994210356, b(32) = 1994420285, b(33) = 3999634122, b(34) = 8018744709 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6484 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.1496 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 70.652, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 2, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 8 (n + 1) (n + 2) (n + 3) a(n) 8 (2 n - 1) (n + 3) (n + 2) a(n + 1) - ------------------------------ + ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 6 (n + 3) (5 n + 37 n + 92) a(n + 2) - ------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (85 n + 1236 n + 5849 n + 9018) a(n + 3) + ------------------------------------------ (n + 9) (n + 7) (n + 11) 3 2 (145 n + 2391 n + 12944 n + 23136) a(n + 4) - --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (209 n + 3896 n + 23899 n + 48348) a(n + 5) + 3/4 --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (175 n + 3509 n + 23130 n + 50136) a(n + 6) - 3/4 --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 3 (31 n + 642 n + 4382 n + 9839) a(n + 7) + ------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (56 n + 1224 n + 8821 n + 20922) a(n + 8) - ------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (35 n + 828 n + 6453 n + 16548) a(n + 9) + 3/4 ------------------------------------------ (n + 9) (n + 7) (n + 11) 3 2 (31 n + 789 n + 6602 n + 18144) a(n + 10) - 1/4 ------------------------------------------- + a(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 28, a(8) = 66, a(9) = 146, a(10) = 315, a(11) = 668 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 6 2 4 (n + 1) b(n) 2 (n + 13) b(n + 1) (9 n + 61 n + 94) b(n + 2) - -------------- - ------------------- + --------------------------- n + 6 n + 6 (n + 6) (n + 2) 2 2 (7 n + 59 n + 130) b(n + 3) (3 n + 27 n + 56) b(n + 4) - 1/2 ---------------------------- + --------------------------- (n + 6) (n + 2) (n + 6) (n + 2) 2 (7 n + 55 n + 88) b(n + 5) - 1/2 --------------------------- + b(n + 6) = 0 (n + 6) (n + 2) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 10 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.7053 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 19.676, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 1]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 5.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 2, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 27 2 (n + 3) (217 n + 2313 n + 5762) a(n + 2) 16 (n + 1) (n + 2) (n + 3) a(n) - ----------------------------------------- - ------------------------------- (n + 25) (n + 23) (n + 27) (n + 25) (n + 23) (n + 27) 2 (41 n + 197) (n + 3) (n + 2) a(n + 1) + --------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (9835 n + 606504 n + 12435313 n + 84762926) a(n + 22) - 3/8 ------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (4088 n + 263937 n + 5667833 n + 40480170) a(n + 23) + 3/8 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (1948 n + 131211 n + 2940146 n + 21916752) a(n + 24) - 1/4 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (877 n + 61407 n + 1430474 n + 11086176) a(n + 25) + 1/8 ---------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (41 n + 2975 n + 71814 n + 576696) a(n + 26) - 3/8 ---------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (2194 n + 119839 n + 1778062 n + 7521599) a(n + 13) + 3/2 ----------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (35674 n + 1773303 n + 27557915 n + 135383760) a(n + 14) - 1/4 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (110819 n + 5453148 n + 87228913 n + 454571364) a(n + 15) + 1/8 ----------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (138590 n + 6837387 n + 111461521 n + 600287412) a(n + 16) - 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (150739 n + 7543161 n + 125408060 n + 692511078) a(n + 17) + 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (48450 n + 2492123 n + 42612987 n + 242190106) a(n + 18) - 3/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (123563 n + 6606198 n + 117348817 n + 692466282) a(n + 19) + 1/8 ------------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (91061 n + 5096097 n + 94742608 n + 585021660) a(n + 20) - 1/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (56950 n + 3346083 n + 65332979 n + 423854358) a(n + 21) + 1/8 ---------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (2828 n + 74535 n + 1027717 n + 6823616) a(n + 12) + 3/4 ---------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (13340 n + 382281 n + 3853927 n + 13612188) a(n + 9) - 1/2 ------------------------------------------------------ (n + 25) (n + 23) (n + 27) 3 2 (10360 n + 331313 n + 3791049 n + 15344606) a(n + 10) + 3/4 ------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (24821 n + 840798 n + 10669351 n + 49540566) a(n + 11) - 1/4 -------------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (661 n + 12186 n + 68141 n + 119820) a(n + 3) + 1/2 ----------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1619 n + 43794 n + 322219 n + 719052) a(n + 4) - 1/4 ------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1055 n + 57921 n + 586642 n + 1666068) a(n + 5) + 1/4 -------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (1411 n - 27732 n - 588409 n - 2283594) a(n + 6) + 1/4 -------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (7003 n + 106638 n + 414395 n + 61944) a(n + 7) - 1/4 ------------------------------------------------- (n + 25) (n + 23) (n + 27) 3 2 (16520 n + 396261 n + 3294553 n + 9566784) a(n + 8) + 1/4 ----------------------------------------------------- + a(n + 27) = (n + 25) (n + 23) (n + 27) 0 Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 43, a(9) = 96, a(10) = 211, a(11) = 457, a(12) = 977, a(13) = 2066, a(14) = 4335, a(15) = 9043, a(16) = 18773, a(17) = 38808, a(18) = 79926, a(19) = 164082, a(20) = 335935, a(21) = 686191, a(22) = 1398825, a(23) = 2846522, a(24) = 5783449, a(25) = 11734363, a(26) = 23779481, a(27) = 48136650 Lemma , 5.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 31 2 4 (n + 2) (41 n + 319 n + 578) b(n + 1) - ---------------------------------------- (n + 30) (n + 27) (n + 31) 2 2 (n + 3) (317 n + 3004 n + 6860) b(n + 2) + ------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (n + 4) (1367 n + 13817 n + 34668) b(n + 3) - -------------------------------------------- (n + 30) (n + 27) (n + 31) 40 (n + 4) (n + 2) (n + 1) b(n) + ------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (219841 n + 15260703 n + 352276382 n + 2704849992) b(n + 22) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (15697 n + 1089282 n + 25196863 n + 194289379) b(n + 23) + ------------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (131861 n + 9321339 n + 219615346 n + 1724569932) b(n + 24) - 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (12632 n + 917991 n + 22223224 n + 179214461) b(n + 25) + --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (11803 n + 885537 n + 22123486 n + 184038956) b(n + 26) - 1/2 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (2191 n + 169972 n + 4389786 n + 37740239) b(n + 27) + ------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (622 n + 49893 n + 1332181 n + 11839112) b(n + 28) - ---------------------------------------------------- + b(n + 31) (n + 30) (n + 27) (n + 31) 3 2 (285347 n + 11873199 n + 164577457 n + 759517260) b(n + 12) + 1/3 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (676003 n + 29047284 n + 414029789 n + 1958127000) b(n + 13) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (710573 n + 31104420 n + 449225863 n + 2138936610) b(n + 14) + 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 2 (55081 n + 2413767 n + 34546369 n + 160537831) b(n + 15) - ------------------------------------------------------------ (n + 30) (n + 27) (n + 31) 3 2 (134017 n + 5713248 n + 77409053 n + 323486901) b(n + 16) + 2/3 ----------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (363461 n + 14107581 n + 155653018 n + 350454414) b(n + 17) - 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (59177 n + 1527188 n - 4593053 n - 233167334) b(n + 18) + 1/2 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (3778 n - 2054025 n - 83786608 n - 825023673) b(n + 19) - 1/3 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (124340 n + 10793937 n + 283816471 n + 2353755696) b(n + 20) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (202055 n + 14641098 n + 347899777 n + 2720492766) b(n + 21) + 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (2573 n + 39434 n + 200097 n + 336164) b(n + 4) + ------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (12125 n + 202479 n + 1131574 n + 2119536) b(n + 5) - 1/3 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (18085 n + 349251 n + 2339360 n + 5453028) b(n + 6) + 1/3 ----------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57755 n + 1376061 n + 11647360 n + 34572504) b(n + 7) - 1/6 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (98803 n + 2892906 n + 29617499 n + 103973808) b(n + 8) + 1/6 --------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (57501 n + 1952119 n + 22643618 n + 88549796) b(n + 9) - 1/2 -------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (285205 n + 10647015 n + 133966544 n + 564171432) b(n + 10) + 1/6 ------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 3 2 (427376 n + 16996437 n + 226221259 n + 1004778456) b(n + 11) - 1/6 -------------------------------------------------------------- (n + 30) (n + 27) (n + 31) 2 (49 n + 2718 n + 37589) b(n + 30) - 1/3 ---------------------------------- (n + 31) (n + 27) 2 (n + 29) (253 n + 13627 n + 183000) b(n + 29) + 1/2 ---------------------------------------------- = 0 (n + 30) (n + 27) (n + 31) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 7, b(7) = 17, b(8) = 39, b(9) = 87, b(10) = 192, b(11) = 416, b(12) = 889, b(13) = 1882, b(14) = 3955, b(15) = 8264, b(16) = 17182, b(17) = 35567, b(18) = 73348, b(19) = 150781, b(20) = 309125, b(21) = 632284, b(22) = 1290635, b(23) = 2629730, b(24) = 5349666, b(25) = 10867530, b(26) = 22049244, b(27) = 44686323, b(28) = 90474100, b(29) = 183014997, b(30) = 369913867, b(31) = 747137182 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.5702 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.7330 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 63.116, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 1]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 1, 1]}, then , {[1, 2, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 2 48 (n - 1) (n - 2) (n + 1) a(n) 24 (n - 1) (13 n + 20 n - 8) a(n + 1) - ------------------------------- + -------------------------------------- (n + 15) (n + 13) (n + 11) (n + 15) (n + 13) (n + 11) 3 2 8 (101 n + 279 n + 10 n + 12) a(n + 2) - ---------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 2 (613 n + 3186 n + 4019 n + 1806) a(n + 3) + --------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1420 n + 11397 n + 26957 n + 20070) a(n + 4) - ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (2876 n + 30981 n + 102301 n + 104286) a(n + 5) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (5059 n + 68451 n + 293006 n + 400344) a(n + 6) - 1/4 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1967 n + 32841 n + 177064 n + 308310) a(n + 7) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1375 n + 27294 n + 175778 n + 364884) a(n + 8) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (285 n + 6571 n + 49486 n + 120990) a(n + 9) + 3/2 ---------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (493 n + 13020 n + 112778 n + 318696) a(n + 10) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (253 n + 7407 n + 71288 n + 224754) a(n + 11) + 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (109 n + 3510 n + 37382 n + 131556) a(n + 12) - 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (43 n + 1524 n + 17915 n + 69834) a(n + 13) + 1/2 --------------------------------------------- (n + 15) (n + 13) (n + 11) 2 (3 n + 38) (3 n + 75 n + 460) a(n + 14) - 3/4 ---------------------------------------- + a(n + 15) = 0 (n + 15) (n + 13) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 30, a(8) = 69, a(9) = 152, a(10) = 325, a(11) = 682, a(12) = 1415, a(13) = 2912, a(14) = 5958, a(15) = 12142 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[2, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 2 48 (n - 1) (n - 2) (n + 1) b(n) 24 (n - 1) (5 n + 4 n - 8) b(n + 1) ------------------------------- - ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 24 n (n - 15 n - 44) b(n + 2) + ------------------------------ (n + 9) (n + 7) (n + 11) 2 6 (n + 1) (17 n + 157 n + 334) b(n + 3) + ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 3 (n + 2) (20 n + 197 n + 499) b(n + 4) - ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 3) (100 n + 1083 n + 2798) b(n + 5) + 1/2 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 4) (329 n + 3421 n + 8190) b(n + 6) - 1/4 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 5) (31 n + 350 n + 926) b(n + 7) + 3/2 -------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 6) (28 n + 429 n + 1652) b(n + 8) - 1/2 --------------------------------------- (n + 9) (n + 7) (n + 11) 2 (7 n + 123 n + 532) b(n + 9) + 3/2 ----------------------------- (n + 11) (n + 9) 2 (n + 8) (23 n + 401 n + 1698) b(n + 10) - 1/4 ---------------------------------------- + b(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 58, b(9) = 126, b(10) = 268, b(11) = 562 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.70526 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 27.728, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 1]}, than in, {[1, 2, 1, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 7.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 1]}, then , {[1, 2, 1, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 48 (n + 4) (n + 2) (n + 1) a(n) 192 (n + 2) (2 n + 14 n + 23) a(n + 1) - ------------------------------- + --------------------------------------- (n + 20) (n + 18) (n + 22) (n + 20) (n + 18) (n + 22) 3 2 8 (172 n + 1893 n + 6800 n + 8016) a(n + 2) - --------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 4 (758 n + 10047 n + 44173 n + 64524) a(n + 3) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (4819 n + 76083 n + 400370 n + 702456) a(n + 4) - ------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (2016 n + 36691 n + 222177 n + 447772) a(n + 5) + --------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3943 n + 76485 n + 488416 n + 1024064) a(n + 6) - 3/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7399 n + 113904 n + 406553 n - 252312) a(n + 7) + 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (49 n + 20889 n + 354608 n + 1538492) a(n + 8) + -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7600 n + 378129 n + 5149847 n + 21333636) a(n + 9) - 1/2 ----------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23197 n + 1054791 n + 14420276 n + 62013648) a(n + 10) + 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (8553 n + 379750 n + 5301329 n + 23762652) a(n + 11) - 3/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (13181 n + 568932 n + 7982584 n + 36642720) a(n + 12) + 1/2 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (25949 n + 1095168 n + 15295663 n + 70754724) a(n + 13) - 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23053 n + 974373 n + 13692788 n + 63968616) a(n + 14) + 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (17657 n + 767250 n + 11085565 n + 53244564) a(n + 15) - 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (11491 n + 523299 n + 7924388 n + 39896412) a(n + 16) + 1/4 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3181 n + 153147 n + 2452565 n + 13063683) a(n + 17) - 1/2 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (2965 n + 150729 n + 2548952 n + 14338272) a(n + 18) + 1/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (553 n + 29505 n + 523577 n + 3090021) a(n + 19) - 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (25 n + 1392 n + 25771 n + 158636) a(n + 20) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (17 n + 984 n + 18931 n + 121052) a(n + 21) - 3/4 --------------------------------------------- + a(n + 22) = 0 (n + 20) (n + 18) (n + 22) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 58, a(9) = 128, a(10) = 278, a(11) = 592, a(12) = 1242, a(13) = 2582, a(14) = 5340, a(15) = 10994, a(16) = 22532, a(17) = 46006, a(18) = 93675, a(19) = 190338, a(20) = 386060, a(21) = 781790, a(22) = 1581005 Lemma , 7.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 2, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 32 (n + 4) (n + 2) (n + 1) b(n) 16 (n + 2) (17 n + 121 n + 204) b(n + 1) - ------------------------------- + ----------------------------------------- (n + 19) (n + 23) (n + 22) (n + 19) (n + 23) (n + 22) 3 2 (391 n + 4395 n + 16166 n + 19512) b(n + 2) - 8/3 --------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (862 n + 11352 n + 49625 n + 72084) b(n + 3) + 8/3 ---------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (4337 n + 60585 n + 277480 n + 415056) b(n + 4) - 2/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (2891 n - 6453 n - 405446 n - 1577856) b(n + 5) + 1/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (24611 n + 789633 n + 7454140 n + 21949440) b(n + 6) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (20831 n + 642394 n + 6257419 n + 19631000) b(n + 7) - 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (45356 n + 1476255 n + 15452638 n + 52616220) b(n + 8) + 1/3 -------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (100997 n + 3466092 n + 38704831 n + 141585948) b(n + 9) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (15964 n + 561192 n + 6495337 n + 24817314) b(n + 10) + ------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (81329 n + 2812815 n + 32190844 n + 121865880) b(n + 11) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (63749 n + 2108124 n + 22585687 n + 77369856) b(n + 12) + 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (46979 n + 1504269 n + 14828500 n + 41540454) b(n + 13) - 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (10463 n + 338295 n + 3219492 n + 7431108) b(n + 14) + 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5445 n + 176200 n + 1562077 n + 2140506) b(n + 15) - 1/2 ----------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3548 n + 59139 n - 881945 n - 14741124) b(n + 16) + 1/6 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3997 n + 247923 n + 4968260 n + 32450070) b(n + 17) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5657 n + 313332 n + 5773981 n + 35400798) b(n + 18) - 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (1295 n + 72404 n + 1347469 n + 8345880) b(n + 19) + 1/2 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (567 n + 32650 n + 625459 n + 3985028) b(n + 20) - 1/2 -------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 2 (40 n + 2385 n + 47286 n + 311657) b(n + 21) + ------------------------------------------------ (n + 19) (n + 23) (n + 22) 2 (10 n + 398 n + 3939) b(n + 22) - 4/3 -------------------------------- + b(n + 23) = 0 (n + 23) (n + 19) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 10, b(7) = 23, b(8) = 52, b(9) = 116, b(10) = 253, b(11) = 538, b(12) = 1129, b(13) = 2355, b(14) = 4887, b(15) = 10086, b(16) = 20710, b(17) = 42368, b(18) = 86455, b(19) = 176039, b(20) = 357739, b(21) = 725714, b(22) = 1470089, b(23) = 2974515 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6348 1/2 - ------ 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 45.581, seconds to generate The best bet against, [1, 2, 1, 2], is a member of, {[1, 1, 1, 2], [1, 2, 2, 2]}, 0.2821 and then your edge, if you have n rolls, is approximately, ------ 1/2 n The next best bet is a member of, {[2, 1, 1, 1], [2, 2, 1, 1], [2, 2, 2, 1]}, 0.28206 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 2, 2]}, 0.25229 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 2, 1], [2, 1, 2, 2]}, 0.1628 and then your edge is approximately, ------ 1/2 n The next best bet is a member of, {[1, 2, 1, 1], [1, 2, 2, 1], [2, 1, 1, 2], [2, 2, 1, 2]}, 0.1411 and then your edge is approximately, ------ 1/2 n The next best bet is a member of, {[2, 1, 2, 1]}, and then your edge is exactly 0 The next best bet is a member of, {[1, 1, 1, 1], [2, 2, 2, 2]}, 0.4988 and then your edge is approximately, - ------ 1/2 n ----------------------- This ends this chapter that took, 268.384, seconds to generate. ----------------------------------------------------------------- Chapter Number, 7 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 2, 2, 1], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 20 2 (2 n + 3) (n + 2) (n + 1) a(n) (n + 2) (14 n + 65 n + 87) a(n + 1) 16/3 ------------------------------ - 8/3 ------------------------------------ (n + 20) (n + 19) (n + 16) (n + 20) (n + 19) (n + 16) 3 2 (4 n + 9 n - 64 n - 168) a(n + 2) + 16/3 ----------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (119 n + 2055 n + 11056 n + 18972) a(n + 3) + 4/3 --------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (431 n + 7515 n + 42076 n + 76452) a(n + 4) - 2/3 --------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (401 n + 7632 n + 47701 n + 98502) a(n + 5) + 2/3 --------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (653 n + 15417 n + 121300 n + 317772) a(n + 6) - 2/3 ------------------------------------------------ (n + 20) (n + 19) (n + 16) 3 2 (553 n + 14173 n + 119736 n + 333868) a(n + 7) + ------------------------------------------------ (n + 20) (n + 19) (n + 16) 3 2 (2591 n + 69597 n + 620134 n + 1836048) a(n + 8) - 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (723 n + 23717 n + 260806 n + 959120) a(n + 9) + 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 16) 3 2 (655 n + 26775 n + 350426 n + 1486440) a(n + 10) - 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (1553 n + 69303 n + 976744 n + 4431504) a(n + 11) + 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (339 n + 16075 n + 243732 n + 1198448) a(n + 12) - 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (89 n + 5233 n + 93432 n + 526884) a(n + 13) + ---------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (403 n + 25317 n + 478562 n + 2845824) a(n + 14) - 1/6 -------------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (85 n + 4993 n + 92794 n + 555648) a(n + 15) + 1/2 ---------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (115 n + 4617 n + 58400 n + 222816) a(n + 16) + 1/6 ----------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (33 n + 1605 n + 25876 n + 138144) a(n + 17) - 3/2 ---------------------------------------------- (n + 20) (n + 19) (n + 16) 3 2 (63 n + 3209 n + 54266 n + 304472) a(n + 18) + 1/2 ---------------------------------------------- (n + 20) (n + 19) (n + 16) 2 3 (3 n + 102 n + 860) a(n + 19) - -------------------------------- + a(n + 20) = 0 (n + 20) (n + 16) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 18, a(8) = 42, a(9) = 93, a(10) = 206, a(11) = 441, a(12) = 942, a(13) = 1981, a(14) = 4159, a(15) = 8648, a(16) = 17937, a(17) = 36978, a(18) = 76075, a(19) = 155897, a(20) = 318905 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 34 2 (7 n + 445 n + 7058) b(n + 33) (2 n + 3) (n + 2) (n + 1) b(n) - ------------------------------- - 16/3 ------------------------------ (n + 34) (n + 31) (n + 30) (n + 34) (n + 31) 2 2 (n + 32) (2 n + 113 n + 1591) b(n + 31) + ------------------------------------------ + b(n + 34) (n + 30) (n + 34) (n + 31) 3 2 (817 n + 24924 n + 232409 n + 673710) b(n + 5) - 2/3 ------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (3887 n + 105927 n + 955960 n + 2829660) b(n + 6) + 2/3 --------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (7343 n + 202983 n + 1846060 n + 5510940) b(n + 7) - 1/3 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4055 n + 250581 n + 3545446 n + 14583120) b(n + 8) + 1/6 ----------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (11537 n + 603975 n + 8721634 n + 38403600) b(n + 9) - 1/6 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (12109 n + 445625 n + 5453630 n + 22179208) b(n + 10) + 1/2 ------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (5995 n + 162805 n + 1274180 n + 2177776) b(n + 11) - 1/2 ----------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2759 n + 83670 n + 1125721 n + 6572364) b(n + 12) + 1/3 ---------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (19345 n + 751587 n + 10410818 n + 51206568) b(n + 13) - 1/6 -------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (39521 n + 1361697 n + 14068090 n + 37762584) b(n + 14) + 1/6 --------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (3367 n + 70834 n - 142443 n - 6618800) b(n + 15) - --------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2975 n + 436281 n + 11123722 n + 78229968) b(n + 16) - 1/6 ------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (13735 n + 697197 n + 10973054 n + 51484680) b(n + 17) - 1/6 -------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (1118 n + 38313 n + 42100 n - 5230272) b(n + 18) + 2/3 -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (14267 n + 927903 n + 19842514 n + 139715520) b(n + 19) + 1/6 --------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (2631 n + 138596 n + 2385021 n + 13351252) b(n + 20) - ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (14885 n + 805299 n + 14455690 n + 86469192) b(n + 21) + 1/6 -------------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4261 n + 291675 n + 6633866 n + 50039184) b(n + 22) - 1/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (3937 n + 280353 n + 6506858 n + 49185036) b(n + 23) + 1/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (2003 n + 137130 n + 3106051 n + 23252124) b(n + 24) - 2/3 ------------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 4 (51 n + 4648 n + 137189 n + 1319637) b(n + 25) + -------------------------------------------------- (n + 30) (n + 34) (n + 31) 2 (n + 2) (2 n + 23 n + 33) b(n + 1) - 8/3 ----------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (4 n + 51 n + 164 n + 144) b(n + 2) + 16/3 ------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 4 (75 n + 1279 n + 6884 n + 11844) b(n + 3) + --------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 2 (483 n + 9431 n + 59428 n + 121828) b(n + 4) - ------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (374 n + 18570 n + 226453 n - 77358) b(n + 26) + 2/3 ------------------------------------------------ (n + 30) (n + 34) (n + 31) 3 2 (191 n + 11160 n + 198013 n + 973926) b(n + 27) - 2/3 ------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 2 (94 n + 7173 n + 181402 n + 1519660) b(n + 28) + -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (379 n + 28815 n + 719120 n + 5867004) b(n + 29) - 1/3 -------------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (3 n - 153 n - 16450 n - 274744) b(n + 30) + -------------------------------------------- (n + 30) (n + 34) (n + 31) 3 2 (13 n + 1211 n + 37562 n + 387944) b(n + 32) + ---------------------------------------------- = 0 (n + 30) (n + 34) (n + 31) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 29, b(8) = 67, b(9) = 148, b(10) = 324, b(11) = 693, b(12) = 1468, b(13) = 3067, b(14) = 6372, b(15) = 13138, b(16) = 26985, b(17) = 55151, b(18) = 112401, b(19) = 228339, b(20) = 462949, b(21) = 936565, b(22) = 1891970, b(23) = 3816208, b(24) = 7689352, b(25) = 15476943, b(26) = 31127327, b(27) = 62555884, b(28) = 125644462, b(29) = 252220247, b(30) = 506092386, b(31) = 1015092415, b(32) = 2035362654, b(33) = 4079902625, b(34) = 8176228211 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7464 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.10664 1/2 - ------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 59.571, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 2, 2, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 3.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 2, 2]}, then , {[1, 2, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 3 2 (n - 1) (n - 3) (n + 1) a(n) 32 (13 n + 5 n - 58 n + 8) a(n + 1) -512/3 ---------------------------- - ------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 3 2 (68 n + 129 n - 77 n - 312) a(n + 2) + 16/3 -------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 8 (61 n + 276 n + 211 n + 304) a(n + 3) + ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (239 n + 1353 n + 1240 n + 6) a(n + 4) - 8/3 ---------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (327 n + 3225 n + 9392 n + 8372) a(n + 5) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (406 n + 8373 n + 48773 n + 83460) a(n + 6) + 1/3 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (4141 n + 57564 n + 228659 n + 246684) a(n + 7) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (1589 n + 27240 n + 150067 n + 275250) a(n + 8) + 1/3 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (556 n + 12879 n + 96668 n + 226989) a(n + 9) - 1/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (242 n + 5616 n + 41746 n + 100377) a(n + 10) - 2/3 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (234 n + 6360 n + 56059 n + 158767) a(n + 11) + ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (749 n + 23580 n + 243163 n + 815100) a(n + 12) - 1/6 ------------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (16 n + 475 n + 4511 n + 13856) a(n + 13) + ------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 9420 n + 122771 n + 516186) a(n + 14) + 1/6 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 2 (227 n + 6051 n + 39190) a(n + 15) - 1/6 ----------------------------------- (n + 19) (n + 18) 3 2 (23 n + 994 n + 14247 n + 67728) a(n + 16) + 1/2 -------------------------------------------- (n + 15) (n + 19) (n + 18) 2 2 (11 n + 347 n + 2712) a(n + 17) (5 n + 164 n + 1331) a(n + 18) + 1/2 -------------------------------- - ------------------------------- (n + 18) (n + 15) (n + 19) (n + 15) + a(n + 19) = 0 Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 20, a(8) = 46, a(9) = 103, a(10) = 225, a(11) = 484, a(12) = 1027, a(13) = 2159, a(14) = 4504, a(15) = 9341, a(16) = 19277, a(17) = 39625, a(18) = 81182, a(19) = 165868 Lemma , 3.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[2, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 (n - 1) (n - 3) (n + 1) b(n) 32 (n - 2) (27 n + 57 n - 4) b(n + 1) 512/3 ---------------------------- + -------------------------------------- (n + 20) (n + 19) (n + 23) (n + 20) (n + 19) (n + 23) 2 (n - 1) (106 n + 523 n + 264) b(n + 2) + 16/3 --------------------------------------- (n + 20) (n + 19) (n + 23) 2 n (809 n + 3750 n + 3001) b(n + 3) - 8/3 ----------------------------------- (n + 20) (n + 19) (n + 23) 2 (n + 1) (263 n + 2176 n + 3621) b(n + 4) - 16/3 ----------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2885 n + 17871 n + 2956 n - 36732) b(n + 5) + 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3596 n + 46275 n + 199033 n + 290196) b(n + 6) - 1/3 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (141 n + 12350 n + 123373 n + 268116) b(n + 7) + 1/2 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (18607 n + 313029 n + 1622054 n + 2707140) b(n + 8) + 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (13639 n + 244392 n + 1325123 n + 2166930) b(n + 9) - 1/6 ----------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (167 n - 4110 n - 119489 n - 543492) b(n + 10) - 1/3 ------------------------------------------------ (n + 20) (n + 19) (n + 23) 3 2 (2085 n + 46632 n + 317431 n + 654464) b(n + 11) + 1/2 -------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (2869 n + 82765 n + 770364 n + 2297612) b(n + 12) - 1/2 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (3163 n + 90240 n + 805451 n + 2194830) b(n + 13) + 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (305 n + 10793 n + 121000 n + 419206) b(n + 14) + ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (1769 n + 60522 n + 655861 n + 2213700) b(n + 15) - 1/6 --------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (289 n + 11139 n + 140578 n + 583028) b(n + 16) + 1/2 ------------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (41 n + 672 n - 11051 n - 184002) b(n + 17) - 1/6 --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (50 n + 2193 n + 31339 n + 146010) b(n + 18) - 2/3 ---------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (11 n + 779 n + 17206 n + 121096) b(n + 19) - --------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 2 (5 n + 277 n + 5086 n + 30938) b(n + 20) + -------------------------------------------- (n + 20) (n + 19) (n + 23) 3 2 (8 n + 491 n + 10009 n + 67774) b(n + 21) + ------------------------------------------- (n + 20) (n + 19) (n + 23) 2 (6 n + 251 n + 2614) b(n + 22) - ------------------------------- + b(n + 23) = 0 (n + 23) (n + 20) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 73, b(9) = 164, b(10) = 357, b(11) = 762, b(12) = 1602, b(13) = 3332, b(14) = 6873, b(15) = 14090, b(16) = 28745, b(17) = 58422, b(18) = 118382, b(19) = 239313, b(20) = 482859, b(21) = 972776, b(22) = 1957357, b(23) = 3934549 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.099749 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 41.809, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 2]}, then , {[1, 2, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) a(n) 8 (7 n + 23) (n + 3) (n + 2) a(n + 1) -32/3 ---------------------------- + ------------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (79 n + 543 n + 914) a(n + 2) - 4/3 -------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 2 (33 n + 302 n + 793 n + 456) a(n + 3) + ----------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (65 n + 1122 n + 5437 n + 7332) a(n + 4) + 1/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (30 n + 209 n - 661 n - 4956) a(n + 5) - ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (35 n + 1791 n + 22708 n + 82704) a(n + 6) + 1/3 -------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (247 n + 10383 n + 118526 n + 409968) a(n + 7) - 1/3 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (301 n + 10370 n + 110313 n + 373320) a(n + 8) + 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (370 n + 10647 n + 96701 n + 275448) a(n + 9) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (153 n + 5619 n + 67674 n + 268232) a(n + 10) - 1/2 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (373 n + 13551 n + 164192 n + 663912) a(n + 11) + 1/6 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (81 n + 2745 n + 30302 n + 108032) a(n + 12) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (371 n + 13395 n + 159412 n + 623520) a(n + 13) - 1/6 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (30 n + 1031 n + 11343 n + 39086) a(n + 14) + 1/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (61 n + 2742 n + 40823 n + 201222) a(n + 15) + 1/6 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (19 n + 545 n + 3864) a(n + 16) - 1/3 -------------------------------- + a(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 27, a(8) = 61, a(9) = 134, a(10) = 287, a(11) = 605, a(12) = 1262, a(13) = 2609, a(14) = 5365, a(15) = 10981, a(16) = 22402, a(17) = 45582 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 32 (n + 1) (n + 2) (n + 3) b(n) 8 (11 n + 23) (n + 3) (n + 2) b(n + 1) ------------------------------- - -------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 2 4 (n + 3) (19 n + 29 n - 122) b(n + 2) + --------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (11 n + 32 n + 77 n + 464) b(n + 3) - --------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (139 n + 3536 n + 26625 n + 61876) b(n + 4) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (543 n + 12922 n + 97251 n + 235528) b(n + 5) - ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (865 n + 20848 n + 163745 n + 421762) b(n + 6) + ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (729 n + 18954 n + 162871 n + 463750) b(n + 7) - ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (589 n + 18708 n + 192295 n + 645056) b(n + 8) + 1/2 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (69 n + 4646 n + 64553 n + 251400) b(n + 9) - 1/2 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (129 n + 2864 n + 8441 n - 78726) b(n + 10) + 1/2 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (259 n + 3818 n - 18479 n - 323286) b(n + 11) - 1/2 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 3976 n - 7847 n - 260492) b(n + 12) + 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (89 n + 2500 n + 20433 n + 38846) b(n + 13) - --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (72 n + 2759 n + 35133 n + 148694) b(n + 14) + ---------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (61 n + 2458 n + 32675 n + 143014) b(n + 15) - 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 2 (n + 16) (15 n + 510 n + 4243) b(n + 16) - ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (43 n + 2088 n + 33709 n + 180896) b(n + 17) + 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 2 4 (2 n + 64 n + 509) b(n + 18) - ------------------------------- + b(n + 19) = 0 (n + 19) (n + 15) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 57, b(9) = 123, b(10) = 261, b(11) = 549, b(12) = 1144, b(13) = 2366, b(14) = 4870, b(15) = 9982, b(16) = 20402, b(17) = 41593, b(18) = 84620, b(19) = 171864 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.5701 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.73292 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 35.543, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 1]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 2]}, then , {[1, 2, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) -32/3 ---------------------------- + 64/3 -------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (5 n + 36 n + 85) a(n + 2) + 16/3 ----------------------------------- (n + 13) (n + 17) (n + 16) 3 2 8 (8 n + 85 n + 299 n + 342) a(n + 3) - --------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (19 n + 984 n + 8621 n + 20928) a(n + 4) - 2/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (17 n + 195 n - 668 n - 7290) a(n + 5) + 2/3 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (203 n + 6354 n + 59527 n + 174384) a(n + 6) + 1/3 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (23 n + 1134 n + 6607 n - 6432) a(n + 7) - 1/6 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (547 n + 18831 n + 207812 n + 741912) a(n + 8) - 1/6 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (173 n + 5736 n + 60643 n + 206404) a(n + 9) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (10 n - 194 n - 8093 n - 51962) a(n + 10) - ------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (79 n + 3191 n + 41760 n + 178392) a(n + 11) - ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (275 n + 10206 n + 125812 n + 515310) a(n + 12) + 1/3 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (161 n + 5904 n + 72577 n + 299874) a(n + 13) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1917 n + 25794 n + 114272) a(n + 14) - 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1984 n + 27751 n + 128474) a(n + 15) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) a(n + 16) - ------------------------------- + a(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 45, a(9) = 101, a(10) = 222, a(11) = 477, a(12) = 1016, a(13) = 2139, a(14) = 4471, a(15) = 9279, a(16) = 19170, a(17) = 39432 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 1, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) 32/5 ---------------------------- + 64/5 -------------------------------- (n + 11) (n + 16) (n + 15) (n + 11) (n + 16) (n + 15) 2 (n + 3) (8 n + 99 n + 265) b(n + 2) + 16/5 ------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 4) (n + 35 n + 114) b(n + 3) - 8/5 ---------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 5) (161 n + 2183 n + 7452) b(n + 4) - 2/5 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 6) (49 n + 543 n + 1178) b(n + 5) + 2/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 7) (7 n + 169 n + 894) b(n + 6) + 18/5 ------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 8) (25 n + 122 n - 1219) b(n + 7) - 3/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 9) (197 n + 681 n - 10208) b(n + 8) + 1/10 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 10) (95 n + 2569 n + 18810) b(n + 9) - 1/10 ------------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 355 n + 3838) b(n + 10) + 3/5 ----------------------------- (n + 16) (n + 15) 2 (n + 12) (113 n + 3339 n + 23152) b(n + 11) - 1/10 -------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 13) (7 n + 168 n + 1028) b(n + 12) + 3/5 ---------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 14) (77 n + 1925 n + 11652) b(n + 13) + 1/10 ------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (11 n + 279 n + 1726) b(n + 14) - 1/2 -------------------------------- + b(n + 15) = 0 (n + 16) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 18, b(8) = 42, b(9) = 93, b(10) = 204, b(11) = 435, b(12) = 924, b(13) = 1940, b(14) = 4054, b(15) = 8408 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.89763 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 31.398, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 7.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 2, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 23 2 32 (n + 4) (n + 2) (n + 1) a(n) 16 (n + 2) (17 n + 121 n + 204) a(n + 1) - ------------------------------- + ----------------------------------------- (n + 19) (n + 23) (n + 22) (n + 19) (n + 23) (n + 22) 3 2 (391 n + 4395 n + 16166 n + 19512) a(n + 2) - 8/3 --------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (862 n + 11352 n + 49625 n + 72084) a(n + 3) + 8/3 ---------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (4337 n + 60585 n + 277480 n + 415056) a(n + 4) - 2/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (2891 n - 6453 n - 405446 n - 1577856) a(n + 5) + 1/3 ------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (24611 n + 789633 n + 7454140 n + 21949440) a(n + 6) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (20831 n + 642394 n + 6257419 n + 19631000) a(n + 7) - 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (45356 n + 1476255 n + 15452638 n + 52616220) a(n + 8) + 1/3 -------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (100997 n + 3466092 n + 38704831 n + 141585948) a(n + 9) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (15964 n + 561192 n + 6495337 n + 24817314) a(n + 10) + ------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (81329 n + 2812815 n + 32190844 n + 121865880) a(n + 11) - 1/6 ---------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (63749 n + 2108124 n + 22585687 n + 77369856) a(n + 12) + 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (46979 n + 1504269 n + 14828500 n + 41540454) a(n + 13) - 1/6 --------------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (10463 n + 338295 n + 3219492 n + 7431108) a(n + 14) + 1/2 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5445 n + 176200 n + 1562077 n + 2140506) a(n + 15) - 1/2 ----------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3548 n + 59139 n - 881945 n - 14741124) a(n + 16) + 1/6 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (3997 n + 247923 n + 4968260 n + 32450070) a(n + 17) + 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (5657 n + 313332 n + 5773981 n + 35400798) a(n + 18) - 1/6 ------------------------------------------------------ (n + 19) (n + 23) (n + 22) 3 2 (1295 n + 72404 n + 1347469 n + 8345880) a(n + 19) + 1/2 ---------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 (567 n + 32650 n + 625459 n + 3985028) a(n + 20) - 1/2 -------------------------------------------------- (n + 19) (n + 23) (n + 22) 3 2 2 (40 n + 2385 n + 47286 n + 311657) a(n + 21) + ------------------------------------------------ (n + 19) (n + 23) (n + 22) 2 (10 n + 398 n + 3939) a(n + 22) - 4/3 -------------------------------- + a(n + 23) = 0 (n + 23) (n + 19) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 23, a(8) = 52, a(9) = 116, a(10) = 253, a(11) = 538, a(12) = 1129, a(13) = 2355, a(14) = 4887, a(15) = 10086, a(16) = 20710, a(17) = 42368, a(18) = 86455, a(19) = 176039, a(20) = 357739, a(21) = 725714, a(22) = 1470089, a(23) = 2974515 Lemma , 7.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 48 (n + 4) (n + 2) (n + 1) b(n) 192 (n + 2) (2 n + 14 n + 23) b(n + 1) - ------------------------------- + --------------------------------------- (n + 20) (n + 18) (n + 22) (n + 20) (n + 18) (n + 22) 3 2 8 (172 n + 1893 n + 6800 n + 8016) b(n + 2) - --------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 4 (758 n + 10047 n + 44173 n + 64524) b(n + 3) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (4819 n + 76083 n + 400370 n + 702456) b(n + 4) - ------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (2016 n + 36691 n + 222177 n + 447772) b(n + 5) + --------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3943 n + 76485 n + 488416 n + 1024064) b(n + 6) - 3/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7399 n + 113904 n + 406553 n - 252312) b(n + 7) + 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (49 n + 20889 n + 354608 n + 1538492) b(n + 8) + -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (7600 n + 378129 n + 5149847 n + 21333636) b(n + 9) - 1/2 ----------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23197 n + 1054791 n + 14420276 n + 62013648) b(n + 10) + 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (8553 n + 379750 n + 5301329 n + 23762652) b(n + 11) - 3/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (13181 n + 568932 n + 7982584 n + 36642720) b(n + 12) + 1/2 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (25949 n + 1095168 n + 15295663 n + 70754724) b(n + 13) - 1/4 --------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (23053 n + 974373 n + 13692788 n + 63968616) b(n + 14) + 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (17657 n + 767250 n + 11085565 n + 53244564) b(n + 15) - 1/4 -------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (11491 n + 523299 n + 7924388 n + 39896412) b(n + 16) + 1/4 ------------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 (3181 n + 153147 n + 2452565 n + 13063683) b(n + 17) - 1/2 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (2965 n + 150729 n + 2548952 n + 14338272) b(n + 18) + 1/4 ------------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (553 n + 29505 n + 523577 n + 3090021) b(n + 19) - 1/2 -------------------------------------------------- (n + 20) (n + 18) (n + 22) 3 2 3 (25 n + 1392 n + 25771 n + 158636) b(n + 20) + ------------------------------------------------ (n + 20) (n + 18) (n + 22) 3 2 (17 n + 984 n + 18931 n + 121052) b(n + 21) - 3/4 --------------------------------------------- + b(n + 22) = 0 (n + 20) (n + 18) (n + 22) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 26, b(8) = 58, b(9) = 128, b(10) = 278, b(11) = 592, b(12) = 1242, b(13) = 2582, b(14) = 5340, b(15) = 10994, b(16) = 22532, b(17) = 46006, b(18) = 93675, b(19) = 190338, b(20) = 386060, b(21) = 781790, b(22) = 1581005 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.6348 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 45.160, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 2, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: Alice is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 8.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[1, 2, 2, 1]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 32 (n + 4) (n + 2) (n + 1) a(n) 16 (n + 2) (9 n + 65 n + 108) a(n + 1) ------------------------------- - --------------------------------------- (n + 18) (n + 22) (n + 21) (n + 18) (n + 22) (n + 21) 3 2 (95 n + 1059 n + 3766 n + 4344) a(n + 2) + 8/3 ------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (58 n + 588 n + 1649 n + 948) a(n + 3) - 8/3 ---------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 2 (77 n + 1717 n + 11448 n + 23888) a(n + 4) - ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (399 n + 7615 n + 47330 n + 96288) a(n + 5) + --------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2779 n + 62073 n + 469100 n + 1196448) a(n + 6) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (915 n + 32374 n + 348995 n + 1187704) a(n + 7) + 1/2 ------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1265 n + 65070 n + 854836 n + 3347712) a(n + 8) - 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2039 n + 110352 n + 1527949 n + 6306432) a(n + 9) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (233 n + 7014 n + 43294 n - 50514) a(n + 10) - 1/3 ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2576 n + 128403 n + 1965073 n + 9540192) a(n + 11) - 1/6 ----------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (3815 n + 182034 n + 2771779 n + 13664040) a(n + 12) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (230 n + 36177 n + 859681 n + 5586654) a(n + 13) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (790 n + 30120 n + 374437 n + 1504222) a(n + 14) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (5555 n + 234558 n + 3278533 n + 15147966) a(n + 15) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (372 n + 16392 n + 239811 n + 1164842) a(n + 16) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (346 n + 17883 n + 305455 n + 1723402) a(n + 17) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1876 n + 97989 n + 1700417 n + 9798390) a(n + 18) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (385 n + 20949 n + 378914 n + 2277356) a(n + 19) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (197 n + 11163 n + 210262 n + 1316016) a(n + 20) + 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 2 (37 n + 1401 n + 13184) a(n + 21) - 1/3 ---------------------------------- + a(n + 22) = 0 (n + 22) (n + 18) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 31, a(8) = 73, a(9) = 162, a(10) = 345, a(11) = 716, a(12) = 1462, a(13) = 2959, a(14) = 5965, a(15) = 12013, a(16) = 24206, a(17) = 48822, a(18) = 98550, a(19) = 198999, a(20) = 401783, a(21) = 810802, a(22) = 1635017 Lemma , 8.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 1]}, then , {[1, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) b(n) 2 (11 n + 67 n + 84) b(n + 1) - ----------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (15 n + 109 n + 180) b(n + 2) (33 n + 413 n + 1116) b(n + 3) - ------------------------------ + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (29 n + 642 n + 2424) b(n + 4) (5 n + 217 n + 1050) b(n + 5) - 1/2 ------------------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (25 n + 323 n + 948) b(n + 6) (20 n + 31 n - 963) b(n + 7) - 1/2 ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (5 n + 199 n + 1332) b(n + 8) (11 n + 91 n - 144) b(n + 9) + ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (49 n + 887 n + 3882) b(n + 10) 7 (3 n + 59 n + 282) b(n + 11) - 1/2 -------------------------------- + ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (15 n + 313 n + 1584) b(n + 12) - 1/2 -------------------------------- + b(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 30, b(8) = 69, b(9) = 150, b(10) = 315, b(11) = 648, b(12) = 1318, b(13) = 2668 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.63472 1/2 - ------- 1/2 n You can see that indeed Alice has a better chance, but not significantly so. ----------------------------------------- This took, 32.937, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 9, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 2]}, than in, {[1, 2, 2, 1]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win The best bet against, [1, 2, 2, 1], is a member of, {[1, 1, 2, 2], [2, 2, 1, 1]}, 0.19943 and then your edge, if you have n rolls, is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 1, 2], [2, 1, 1, 1]}, 0.16282 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 2, 2, 2], [2, 2, 2, 1]}, 0.14102 and then your edge is approximately, ------- 1/2 n The next best bet is a member of, {[1, 1, 2, 1], [1, 2, 1, 1], [2, 1, 1, 2], [2, 1, 2, 2], [2, 2, 1, 2]}, and then your edge is exactly 0 The next best bet is a member of, {[1, 2, 1, 2], [2, 1, 2, 1]}, 0.1411 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[2, 2, 2, 2]}, 0.598451 and then your edge is approximately, - -------- 1/2 n The next best bet is a member of, {[1, 1, 1, 1]}, 0.63976 and then your edge is approximately, - ------- 1/2 n ----------------------- This ends this chapter that took, 246.805, seconds to generate. ----------------------------------------------------------------- Chapter Number, 8 The Relative Probablity of Winning a Daniel Litt style game when rolling a f\ air, 2, sides die marked with, {1, 2}, of number of occurrences of, [1, 2, 2, 2], Versus the number of occurences of all, 4, letter words in, {1, 2} By Shalosh B. Ekhad ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 1, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 1]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 1.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 1, 1]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 4 (n + 1) (n + 2) a(n) 2 (n + 2) (n - 3) a(n + 1) - ---------------------- + -------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 (n + 7) (n + 2) a(n + 2) (33 n + 433 n + 1202) a(n + 3) + ------------------------ + 1/2 ------------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 3 (10 n + 116 n + 319) a(n + 4) (29 n + 331 n + 938) a(n + 5) - -------------------------------- + 1/4 ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (19 n + 45 n - 598) a(n + 6) (47 n + 789 n + 3252) a(n + 7) + 1/4 ----------------------------- + 1/2 ------------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (25 n + 455 n + 2104) a(n + 8) (10 n + 175 n + 766) a(n + 9) - 1/2 ------------------------------- - ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) 2 (22 n + 391 n + 1620) a(n + 10) - 1/2 -------------------------------- (n + 15) (n + 11) 2 2 (24 n + 437 n + 1865) a(n + 11) (n + 30 n + 212) a(n + 12) + 1/2 -------------------------------- + 3/2 --------------------------- (n + 15) (n + 11) (n + 15) (n + 11) 2 2 (7 n + 183 n + 1164) a(n + 13) (5 n + 127 n + 790) a(n + 14) + 1/4 ------------------------------- - 3/4 ------------------------------ (n + 15) (n + 11) (n + 15) (n + 11) + a(n + 15) = 0 Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 19, a(8) = 44, a(9) = 98, a(10) = 213, a(11) = 458, a(12) = 971, a(13) = 2041, a(14) = 4259, a(15) = 8837 Lemma , 1.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[1, 1, 1, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 30 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) -64/3 ---------------------------- + 320/3 -------------------------------- (n + 30) (n + 27) (n + 26) (n + 30) (n + 27) (n + 26) 2 (n + 3) (43 n + 447 n + 1064) b(n + 2) + b(n + 30) - 16/3 --------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (37 n + 2936 n + 77563 n + 682240) b(n + 28) + ---------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (12215 n + 511107 n + 6362536 n + 23354688) b(n + 12) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 4 (1763 n + 78461 n + 1129606 n + 5285864) b(n + 13) + ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (4821 n + 250117 n + 4141498 n + 22161002) b(n + 14) - ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (12589 n + 717072 n + 12757523 n + 72383244) b(n + 15) + 1/6 -------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (12616 n + 528843 n + 7104191 n + 30016968) b(n + 16) - 1/6 ------------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (2548 n + 101031 n + 1299495 n + 5466076) b(n + 17) + 1/2 ----------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (2509 n + 136215 n + 2678474 n + 18811068) b(n + 18) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (1629 n + 73448 n + 1050327 n + 4647608) b(n + 19) + 1/2 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (8971 n + 399351 n + 5313692 n + 18426312) b(n + 20) - 1/6 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (1661 n + 84733 n + 1384546 n + 7105170) b(n + 21) + ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (1423 n + 79008 n + 1432511 n + 8435535) b(n + 22) - 2/3 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (147 n + 5272 n + 19605 n - 548484) b(n + 23) + 1/2 ----------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (259 n + 17651 n + 399308 n + 2997736) b(n + 24) + 1/2 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (7 n + 181 n - 3600 n - 93738) b(n + 25) - ------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (13 n + 986 n + 24853 n + 208138) b(n + 26) + --------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (55 n + 4285 n + 111140 n + 959716) b(n + 27) - ----------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 8 (53 n + 387 n - 26 n - 3270) b(n + 4) + ----------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (409 n - 2592 n - 74161 n - 265080) b(n + 5) - 2/3 ---------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 2 (314 n + 6981 n + 56431 n + 159980) b(n + 6) + ------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 (3260 n + 89631 n + 819925 n + 2489706) b(n + 7) - 2/3 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (7795 n + 182184 n + 1465613 n + 4109280) b(n + 8) + 1/6 ---------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (11368 n + 348369 n + 3280997 n + 9399516) b(n + 9) + 1/6 ----------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (1247 n - 4025 n - 640508 n - 4869616) b(n + 10) - 1/2 -------------------------------------------------- (n + 30) (n + 27) (n + 26) 3 2 (4601 n + 197370 n + 2883557 n + 14111892) b(n + 11) - 1/2 ------------------------------------------------------ (n + 30) (n + 27) (n + 26) 3 2 8 (n + 164 n + 1169 n + 2126) b(n + 3) + ---------------------------------------- (n + 30) (n + 27) (n + 26) 2 (10 n + 551 n + 7565) b(n + 29) - -------------------------------- = 0 (n + 27) (n + 30) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 74, b(9) = 168, b(10) = 368, b(11) = 789, b(12) = 1663, b(13) = 3463, b(14) = 7147, b(15) = 14649, b(16) = 29869, b(17) = 60654, b(18) = 122782, b(19) = 247931, b(20) = 499667, b(21) = 1005458, b(22) = 2020775, b(23) = 4057448, b(24) = 8140568, b(25) = 16322685, b(26) = 32712777, b(27) = 65535263, b(28) = 131249786, b(29) = 262793810, b(30) = 526073271 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7997 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.053309 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 45.965, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 2, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 1, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 3, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 1, 2, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 4, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[1, 2, 1, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 4.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 1, 2]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 6 2 4 (n + 1) a(n) 2 (n + 13) a(n + 1) (9 n + 61 n + 94) a(n + 2) - -------------- - ------------------- + --------------------------- n + 6 n + 6 (n + 6) (n + 2) 2 2 (7 n + 59 n + 130) a(n + 3) (3 n + 27 n + 56) a(n + 4) - 1/2 ---------------------------- + --------------------------- (n + 6) (n + 2) (n + 6) (n + 2) 2 (7 n + 55 n + 88) a(n + 5) - 1/2 --------------------------- + a(n + 6) = 0 (n + 6) (n + 2) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10 Lemma , 4.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[1, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 8 (n + 1) (n + 2) (n + 3) b(n) 8 (2 n - 1) (n + 3) (n + 2) b(n + 1) - ------------------------------ + ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 6 (n + 3) (5 n + 37 n + 92) b(n + 2) - ------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (85 n + 1236 n + 5849 n + 9018) b(n + 3) + ------------------------------------------ (n + 9) (n + 7) (n + 11) 3 2 (145 n + 2391 n + 12944 n + 23136) b(n + 4) - --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (209 n + 3896 n + 23899 n + 48348) b(n + 5) + 3/4 --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (175 n + 3509 n + 23130 n + 50136) b(n + 6) - 3/4 --------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 3 (31 n + 642 n + 4382 n + 9839) b(n + 7) + ------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (56 n + 1224 n + 8821 n + 20922) b(n + 8) - ------------------------------------------- (n + 9) (n + 7) (n + 11) 3 2 (35 n + 828 n + 6453 n + 16548) b(n + 9) + 3/4 ------------------------------------------ (n + 9) (n + 7) (n + 11) 3 2 (31 n + 789 n + 6602 n + 18144) b(n + 10) - 1/4 ------------------------------------------- + b(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 28, b(8) = 66, b(9) = 146, b(10) = 315, b(11) = 668 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.7053 1/2 - ------ 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 20.594, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 5, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 1]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 6, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 1, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 6.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 1, 2]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 19 32 (n + 1) (n + 2) (n + 3) a(n) 8 (11 n + 23) (n + 3) (n + 2) a(n + 1) ------------------------------- - -------------------------------------- (n + 15) (n + 19) (n + 18) (n + 15) (n + 19) (n + 18) 2 4 (n + 3) (19 n + 29 n - 122) a(n + 2) + --------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 2 (11 n + 32 n + 77 n + 464) a(n + 3) - --------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (139 n + 3536 n + 26625 n + 61876) a(n + 4) + --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (543 n + 12922 n + 97251 n + 235528) a(n + 5) - ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (865 n + 20848 n + 163745 n + 421762) a(n + 6) + ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (729 n + 18954 n + 162871 n + 463750) a(n + 7) - ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (589 n + 18708 n + 192295 n + 645056) a(n + 8) + 1/2 ------------------------------------------------ (n + 15) (n + 19) (n + 18) 3 2 (69 n + 4646 n + 64553 n + 251400) a(n + 9) - 1/2 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (129 n + 2864 n + 8441 n - 78726) a(n + 10) + 1/2 --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (259 n + 3818 n - 18479 n - 323286) a(n + 11) - 1/2 ----------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (235 n + 3976 n - 7847 n - 260492) a(n + 12) + 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (89 n + 2500 n + 20433 n + 38846) a(n + 13) - --------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (72 n + 2759 n + 35133 n + 148694) a(n + 14) + ---------------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (61 n + 2458 n + 32675 n + 143014) a(n + 15) - 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 2 (n + 16) (15 n + 510 n + 4243) a(n + 16) - ----------------------------------------- (n + 15) (n + 19) (n + 18) 3 2 (43 n + 2088 n + 33709 n + 180896) a(n + 17) + 1/2 ---------------------------------------------- (n + 15) (n + 19) (n + 18) 2 4 (2 n + 64 n + 509) a(n + 18) - ------------------------------- + a(n + 19) = 0 (n + 19) (n + 15) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 57, a(9) = 123, a(10) = 261, a(11) = 549, a(12) = 1144, a(13) = 2366, a(14) = 4870, a(15) = 9982, a(16) = 20402, a(17) = 41593, a(18) = 84620, a(19) = 171864 Lemma , 6.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[2, 1, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) b(n) 8 (7 n + 23) (n + 3) (n + 2) b(n + 1) -32/3 ---------------------------- + ------------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (79 n + 543 n + 914) b(n + 2) - 4/3 -------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 2 (33 n + 302 n + 793 n + 456) b(n + 3) + ----------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (65 n + 1122 n + 5437 n + 7332) b(n + 4) + 1/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (30 n + 209 n - 661 n - 4956) b(n + 5) - ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (35 n + 1791 n + 22708 n + 82704) b(n + 6) + 1/3 -------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (247 n + 10383 n + 118526 n + 409968) b(n + 7) - 1/3 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (301 n + 10370 n + 110313 n + 373320) b(n + 8) + 1/2 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (370 n + 10647 n + 96701 n + 275448) b(n + 9) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (153 n + 5619 n + 67674 n + 268232) b(n + 10) - 1/2 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (373 n + 13551 n + 164192 n + 663912) b(n + 11) + 1/6 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (81 n + 2745 n + 30302 n + 108032) b(n + 12) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (371 n + 13395 n + 159412 n + 623520) b(n + 13) - 1/6 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (30 n + 1031 n + 11343 n + 39086) b(n + 14) + 1/2 --------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (61 n + 2742 n + 40823 n + 201222) b(n + 15) + 1/6 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (19 n + 545 n + 3864) b(n + 16) - 1/3 -------------------------------- + b(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 11, b(7) = 27, b(8) = 61, b(9) = 134, b(10) = 287, b(11) = 605, b(12) = 1262, b(13) = 2609, b(14) = 5365, b(15) = 10981, b(16) = 22402, b(17) = 45582 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.73292 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.5701 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 35.639, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 7, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 1]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 7.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 2, 1]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 11 2 48 (n - 1) (n - 2) (n + 1) a(n) 24 (n - 1) (5 n + 4 n - 8) a(n + 1) ------------------------------- - ------------------------------------ (n + 9) (n + 7) (n + 11) (n + 9) (n + 7) (n + 11) 2 24 n (n - 15 n - 44) a(n + 2) + ------------------------------ (n + 9) (n + 7) (n + 11) 2 6 (n + 1) (17 n + 157 n + 334) a(n + 3) + ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 3 (n + 2) (20 n + 197 n + 499) a(n + 4) - ---------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 3) (100 n + 1083 n + 2798) a(n + 5) + 1/2 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 4) (329 n + 3421 n + 8190) a(n + 6) - 1/4 ----------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 5) (31 n + 350 n + 926) a(n + 7) + 3/2 -------------------------------------- (n + 9) (n + 7) (n + 11) 2 (n + 6) (28 n + 429 n + 1652) a(n + 8) - 1/2 --------------------------------------- (n + 9) (n + 7) (n + 11) 2 (7 n + 123 n + 532) a(n + 9) + 3/2 ----------------------------- (n + 11) (n + 9) 2 (n + 8) (23 n + 401 n + 1698) a(n + 10) - 1/4 ---------------------------------------- + a(n + 11) = 0 (n + 9) (n + 7) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 11, a(7) = 26, a(8) = 58, a(9) = 126, a(10) = 268, a(11) = 562 Lemma , 7.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[2, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 2 48 (n - 1) (n - 2) (n + 1) b(n) 24 (n - 1) (13 n + 20 n - 8) b(n + 1) - ------------------------------- + -------------------------------------- (n + 15) (n + 13) (n + 11) (n + 15) (n + 13) (n + 11) 3 2 8 (101 n + 279 n + 10 n + 12) b(n + 2) - ---------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 2 (613 n + 3186 n + 4019 n + 1806) b(n + 3) + --------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1420 n + 11397 n + 26957 n + 20070) b(n + 4) - ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (2876 n + 30981 n + 102301 n + 104286) b(n + 5) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (5059 n + 68451 n + 293006 n + 400344) b(n + 6) - 1/4 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1967 n + 32841 n + 177064 n + 308310) b(n + 7) + 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (1375 n + 27294 n + 175778 n + 364884) b(n + 8) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (285 n + 6571 n + 49486 n + 120990) b(n + 9) + 3/2 ---------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (493 n + 13020 n + 112778 n + 318696) b(n + 10) - 1/2 ------------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (253 n + 7407 n + 71288 n + 224754) b(n + 11) + 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (109 n + 3510 n + 37382 n + 131556) b(n + 12) - 1/2 ----------------------------------------------- (n + 15) (n + 13) (n + 11) 3 2 (43 n + 1524 n + 17915 n + 69834) b(n + 13) + 1/2 --------------------------------------------- (n + 15) (n + 13) (n + 11) 2 (3 n + 38) (3 n + 75 n + 460) b(n + 14) - 3/4 ---------------------------------------- + b(n + 15) = 0 (n + 15) (n + 13) (n + 11) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 30, b(8) = 69, b(9) = 152, b(10) = 325, b(11) = 682, b(12) = 1415, b(13) = 2912, b(14) = 5958, b(15) = 12142 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.70526 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4232 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 27.190, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 8, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 1, 2, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 8.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 1, 2, 2]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 15 (n + 1) (n + 2) (n + 3) a(n) (n + 4) (n + 3) (n + 2) a(n + 1) 32/5 ---------------------------- + 64/5 -------------------------------- (n + 11) (n + 16) (n + 15) (n + 11) (n + 16) (n + 15) 2 (n + 3) (8 n + 99 n + 265) a(n + 2) + 16/5 ------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 4) (n + 35 n + 114) a(n + 3) - 8/5 ---------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 5) (161 n + 2183 n + 7452) a(n + 4) - 2/5 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 6) (49 n + 543 n + 1178) a(n + 5) + 2/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 7) (7 n + 169 n + 894) a(n + 6) + 18/5 ------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 8) (25 n + 122 n - 1219) a(n + 7) - 3/5 --------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 9) (197 n + 681 n - 10208) a(n + 8) + 1/10 ----------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 10) (95 n + 2569 n + 18810) a(n + 9) - 1/10 ------------------------------------------ (n + 11) (n + 16) (n + 15) 2 (n + 355 n + 3838) a(n + 10) + 3/5 ----------------------------- (n + 16) (n + 15) 2 (n + 12) (113 n + 3339 n + 23152) a(n + 11) - 1/10 -------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 13) (7 n + 168 n + 1028) a(n + 12) + 3/5 ---------------------------------------- (n + 11) (n + 16) (n + 15) 2 (n + 14) (77 n + 1925 n + 11652) a(n + 13) + 1/10 ------------------------------------------- (n + 11) (n + 16) (n + 15) 2 (11 n + 279 n + 1726) a(n + 14) - 1/2 -------------------------------- + a(n + 15) = 0 (n + 16) (n + 11) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 3, a(6) = 8, a(7) = 18, a(8) = 42, a(9) = 93, a(10) = 204, a(11) = 435, a(12) = 924, a(13) = 1940, a(14) = 4054, a(15) = 8408 Lemma , 8.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[2, 1, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 17 (n + 1) (n + 2) (n + 3) b(n) (n + 4) (n + 3) (n + 2) b(n + 1) -32/3 ---------------------------- + 64/3 -------------------------------- (n + 13) (n + 17) (n + 16) (n + 13) (n + 17) (n + 16) 2 (n + 3) (5 n + 36 n + 85) b(n + 2) + 16/3 ----------------------------------- (n + 13) (n + 17) (n + 16) 3 2 8 (8 n + 85 n + 299 n + 342) b(n + 3) - --------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (19 n + 984 n + 8621 n + 20928) b(n + 4) - 2/3 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (17 n + 195 n - 668 n - 7290) b(n + 5) + 2/3 ---------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (203 n + 6354 n + 59527 n + 174384) b(n + 6) + 1/3 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (23 n + 1134 n + 6607 n - 6432) b(n + 7) - 1/6 ------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (547 n + 18831 n + 207812 n + 741912) b(n + 8) - 1/6 ------------------------------------------------ (n + 13) (n + 17) (n + 16) 3 2 (173 n + 5736 n + 60643 n + 206404) b(n + 9) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (10 n - 194 n - 8093 n - 51962) b(n + 10) - ------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (79 n + 3191 n + 41760 n + 178392) b(n + 11) - ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (275 n + 10206 n + 125812 n + 515310) b(n + 12) + 1/3 ------------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (161 n + 5904 n + 72577 n + 299874) b(n + 13) - 1/6 ----------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1917 n + 25794 n + 114272) b(n + 14) - 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 3 2 (47 n + 1984 n + 27751 n + 128474) b(n + 15) + 1/2 ---------------------------------------------- (n + 13) (n + 17) (n + 16) 2 (8 n + 225 n + 1563) b(n + 16) - ------------------------------- + b(n + 17) = 0 (n + 17) (n + 13) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 19, b(8) = 45, b(9) = 101, b(10) = 222, b(11) = 477, b(12) = 1016, b(13) = 2139, b(14) = 4471, b(15) = 9279, b(16) = 19170, b(17) = 39432 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.89763 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 31.465, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 9, : If Alice bets that there are more occurrences of consec\ utive substrings in, {[2, 2, 1, 1]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 10, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 1, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 10.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 1, 2]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 n (n + 1) (n + 2) a(n) (n + 6) (n + 2) (n + 1) a(n + 1) 128/5 -------------------------- + 128/5 -------------------------------- (n + 22) (n + 18) (n + 23) (n + 22) (n + 18) (n + 23) 2 (n + 2) (n + 40 n + 114) a(n + 2) + 64/5 ---------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (47 n + 696 n + 3067 n + 4200) a(n + 3) - 32/5 ----------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (89 n + 1749 n + 10102 n + 18360) a(n + 4) + 8/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (146 n + 2535 n + 14563 n + 27540) a(n + 5) + 24/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1135 n + 20307 n + 118808 n + 226272) a(n + 6) - 4/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (41 n - 1971 n - 35405 n - 137016) a(n + 7) + 8/5 --------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (761 n + 20961 n + 188354 n + 557392) a(n + 8) + 3/5 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (1246 n + 11163 n - 101365 n - 892320) a(n + 9) - 1/5 ------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (747 n + 39325 n + 564716 n + 2467240) a(n + 10) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (5164 n + 186213 n + 2277779 n + 9455376) a(n + 11) + 1/10 ----------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (429 n + 10722 n + 83205 n + 200240) a(n + 12) - 3/10 ------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4423 n + 192690 n + 2803421 n + 13632954) a(n + 13) - 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (4681 n + 206508 n + 3065069 n + 15295650) a(n + 14) + 1/10 ------------------------------------------------------ (n + 22) (n + 18) (n + 23) 3 2 (529 n + 23526 n + 345573 n + 1670800) a(n + 15) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (310 n + 16167 n + 284545 n + 1686224) a(n + 16) - 3/10 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (1673 n + 86031 n + 1472158 n + 8377752) a(n + 17) + 1/10 ---------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (445 n + 23166 n + 398075 n + 2252814) a(n + 18) - 1/5 -------------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (2 n + 369 n + 12229 n + 112830) a(n + 19) - 2/5 -------------------------------------------- (n + 22) (n + 18) (n + 23) 3 2 (34 n + 2035 n + 40481 n + 267520) a(n + 20) + 3/5 ---------------------------------------------- (n + 22) (n + 18) (n + 23) 2 (8 n + 313 n + 3033) a(n + 21) - ------------------------------- + a(n + 22) = 0 (n + 23) (n + 18) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 10, a(7) = 22, a(8) = 48, a(9) = 105, a(10) = 225, a(11) = 474, a(12) = 990, a(13) = 2060, a(14) = 4266, a(15) = 8794, a(16) = 18061, a(17) = 36996, a(18) = 75606, a(19) = 154191, a(20) = 313884, a(21) = 637997, a(22) = 1295065 Lemma , 10.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[2, 2, 1, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 24 2 2 128 (n + 1) (n + 2) b(n + 1) (n + 2) (5 n + 44 n + 90) b(n + 2) - ----------------------------- + 64/3 ----------------------------------- (n + 20) (n + 24) (n + 23) (n + 20) (n + 24) (n + 23) 2 (9 n + 381 n + 4010) b(n + 23) - ------------------------------- + b(n + 24) (n + 24) (n + 20) 3 2 (1427 n + 79242 n + 1456507 n + 8850516) b(n + 20) - 1/6 ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (45 n + 2085 n + 28960 n + 105652) b(n + 21) + 1/2 ---------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 2 (12 n + 782 n + 16929 n + 121718) b(n + 22) + ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (n + 198 n + 1271 n + 2016) b(n + 3) - 32/3 -------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (121 n + 3957 n + 26918 n + 51576) b(n + 4) + 8/3 --------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (410 n + 11331 n + 84115 n + 187380) b(n + 5) - 8/3 ----------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 4 (89 n - 55 n - 6980 n - 18192) b(n + 6) - ------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4643 n + 113547 n + 932104 n + 2559744) b(n + 7) + 4/3 --------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (9379 n + 249095 n + 2183394 n + 6313392) b(n + 8) - ---------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (4088 n + 43659 n - 354719 n - 3800544) b(n + 9) + 1/3 -------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (64537 n + 2209815 n + 24899180 n + 92453784) b(n + 10) + 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (75946 n + 2486535 n + 26818235 n + 95084496) b(n + 11) - 1/6 --------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (19910 n + 400407 n + 886627 n - 12517440) b(n + 12) + 1/6 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (6258 n + 274251 n + 3910486 n + 18209561) b(n + 13) + ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (15359 n + 601886 n + 7752881 n + 32721250) b(n + 14) - 1/2 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (15259 n + 498897 n + 4779314 n + 11047158) b(n + 15) + 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3915 n + 199999 n + 3338804 n + 18243672) b(n + 16) + 1/2 ------------------------------------------------------ (n + 20) (n + 24) (n + 23) 3 2 (13358 n + 622347 n + 9557149 n + 48264816) b(n + 17) - 1/6 ------------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (3194 n + 132441 n + 1710421 n + 6525726) b(n + 18) + 1/6 ----------------------------------------------------- (n + 20) (n + 24) (n + 23) 3 2 (339 n + 19763 n + 379686 n + 2404056) b(n + 19) + -------------------------------------------------- (n + 20) (n + 24) (n + 23) n (n + 1) (n + 2) b(n) + 128/3 -------------------------- = 0 (n + 20) (n + 24) (n + 23) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 10, b(7) = 23, b(8) = 52, b(9) = 115, b(10) = 247, b(11) = 522, b(12) = 1094, b(13) = 2279, b(14) = 4718, b(15) = 9719, b(16) = 19947, b(17) = 40821, b(18) = 83326, b(19) = 169718, b(20) = 345044, b(21) = 700405, b(22) = 1419839, b(23) = 2874874, b(24) = 5815036 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.89761 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.6982 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 46.607, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 11, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 2, 1]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: They are equally likely to win ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 12, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[2, 2, 2, 2]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 12.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[2, 2, 2, 2]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) a(n) 6 (n + 5 n + 8) a(n + 1) - ----------------------- - ------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (n + 3) (5 n - 8) a(n + 2) (47 n + 451 n + 1092) a(n + 3) - -------------------------- + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (26 n + 261 n + 610) a(n + 4) (4 n - 3 n - 145) a(n + 5) - 1/2 ------------------------------ + 1/2 --------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (16 n + 343 n + 1632) a(n + 6) - 1/2 ------------------------------- (n + 13) (n + 9) 2 (40 n + 629 n + 2413) a(n + 7) + 1/2 ------------------------------- (n + 13) (n + 9) 2 2 (36 n + 547 n + 2054) a(n + 8) (2 n + 39 n + 219) a(n + 9) - 1/2 ------------------------------- + 1/2 ---------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (2 n + 37 n + 188) a(n + 10) (13 n + 252 n + 1163) a(n + 11) + 1/2 ----------------------------- + 1/2 -------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (5 n + 104 n + 522) a(n + 12) - ------------------------------ + a(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 2, a(6) = 5, a(7) = 12, a(8) = 27, a(9) = 62, a(10) = 136, a(11) = 296, a(12) = 638, a(13) = 1360 Lemma , 12.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[2, 2, 2, 2]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 26 3 2 (179 n + 7533 n + 86686 n + 157152) b(n + 21) 1/6 ----------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (58 n + 3453 n + 68237 n + 447690) b(n + 22) - 1/3 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (35 n + 2403 n + 54634 n + 411528) b(n + 23) - 1/6 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (26 n + 1755 n + 39406 n + 294372) b(n + 24) + 2/3 ---------------------------------------------- (n + 23) (n + 22) (n + 26) 32 (n + 4) (n + 2) (n + 1) b(n) - ------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (213 n + 4767 n + 36288 n + 91804) b(n + 5) + --------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (81 n + 601 n - 10194 n - 72944) b(n + 6) + 1/2 ------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (596 n + 24297 n + 291037 n + 1084080) b(n + 7) - 1/3 ------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (1645 n + 58343 n + 656286 n + 2383976) b(n + 8) - 1/2 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (331 n + 12714 n + 138155 n + 434718) b(n + 9) - 1/3 ------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (529 n + 42213 n + 734342 n + 3717216) b(n + 10) + 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (5591 n + 232575 n + 3158530 n + 14087568) b(n + 11) + 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (1013 n + 39041 n + 503132 n + 2175120) b(n + 12) - 1/2 --------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (585 n + 19755 n + 216738 n + 758120) b(n + 13) + 1/2 ------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (345 n + 21595 n + 404428 n + 2372924) b(n + 14) - 1/2 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (3479 n + 158445 n + 2371504 n + 11660352) b(n + 15) + 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (4733 n + 207999 n + 3010018 n + 14293800) b(n + 16) - 1/6 ------------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (157 n + 7761 n + 128012 n + 699980) b(n + 17) + 1/2 ------------------------------------------------ (n + 23) (n + 22) (n + 26) 3 2 (389 n + 17601 n + 266278 n + 1354848) b(n + 18) + 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (1261 n + 59337 n + 898610 n + 4320504) b(n + 19) + 1/6 --------------------------------------------------- (n + 23) (n + 22) (n + 26) 3 2 (817 n + 36609 n + 503048 n + 1961808) b(n + 20) - 1/6 -------------------------------------------------- (n + 23) (n + 22) (n + 26) 2 (15 n + 707 n + 8292) b(n + 25) - 1/2 -------------------------------- (n + 26) (n + 23) 2 16 (n + 2) (7 n + 53 n + 98) b(n + 1) - -------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 3) (79 n + 648 n + 1340) b(n + 2) - 8/3 --------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 4) (65 n + 628 n + 1386) b(n + 3) - 8/3 --------------------------------------- (n + 23) (n + 22) (n + 26) 2 (n + 5) (29 n + 236 n + 108) b(n + 4) - 2/3 -------------------------------------- + b(n + 26) = 0 (n + 23) (n + 22) (n + 26) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 3, b(6) = 8, b(7) = 20, b(8) = 46, b(9) = 105, b(10) = 233, b(11) = 508, b(12) = 1095, b(13) = 2332, b(14) = 4929, b(15) = 10345, b(16) = 21585, b(17) = 44824, b(18) = 92686, b(19) = 190975, b(20) = 392272, b(21) = 803553, b(22) = 1642148, b(23) = 3348847, b(24) = 6816665, b(25) = 13852607, b(26) = 28109365 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 1.058 1/2 - ----- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.070537 1/2 - -------- 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 38.623, seconds to generate ----------------------------------------------------------------------------\ ----------------------- Question Mumber, 13, : If Alice bets that there are more occurrences of conse\ cutive substrings in, {[1, 1, 2, 1]}, than in, {[1, 2, 2, 2]}, and Bob, bets vice versa, who is more likely to win? Answer: Bob is more likely to win. Let's be more quantitative. We need the following two lemmas Lemma , 13.1, : Let a(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 1, 2, 1]}, then , {[1, 2, 2, 2]} a(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 13 2 12 (n + 4) (n + 1) a(n) 2 (11 n + 67 n + 84) a(n + 1) - ----------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (15 n + 109 n + 180) a(n + 2) (33 n + 413 n + 1116) a(n + 3) - ------------------------------ + 1/2 ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (29 n + 642 n + 2424) a(n + 4) (5 n + 217 n + 1050) a(n + 5) - 1/2 ------------------------------- + ------------------------------ (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (25 n + 323 n + 948) a(n + 6) (20 n + 31 n - 963) a(n + 7) - 1/2 ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (5 n + 199 n + 1332) a(n + 8) (11 n + 91 n - 144) a(n + 9) + ------------------------------ + 1/2 ----------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 2 (49 n + 887 n + 3882) a(n + 10) 7 (3 n + 59 n + 282) a(n + 11) - 1/2 -------------------------------- + ------------------------------- (n + 13) (n + 9) (n + 13) (n + 9) 2 (15 n + 313 n + 1584) a(n + 12) - 1/2 -------------------------------- + a(n + 13) = 0 (n + 13) (n + 9) Subject to the initial conditions a(1) = 0, a(2) = 0, a(3) = 0, a(4) = 1, a(5) = 4, a(6) = 12, a(7) = 30, a(8) = 69, a(9) = 150, a(10) = 315, a(11) = 648, a(12) = 1318, a(13) = 2668 Lemma , 13.2, : Let b(n) be the number of words of length n in the alphabet , {1, 2}, with more occurences of, {[1, 2, 2, 2]}, then , {[1, 1, 2, 1]} b(n) satisfies the following linear recurrence equation with polynomial coef\ ficients of order, 22 2 32 (n + 4) (n + 2) (n + 1) b(n) 16 (n + 2) (9 n + 65 n + 108) b(n + 1) ------------------------------- - --------------------------------------- (n + 18) (n + 22) (n + 21) (n + 18) (n + 22) (n + 21) 3 2 (95 n + 1059 n + 3766 n + 4344) b(n + 2) + 8/3 ------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (58 n + 588 n + 1649 n + 948) b(n + 3) - 8/3 ---------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 2 (77 n + 1717 n + 11448 n + 23888) b(n + 4) - ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (399 n + 7615 n + 47330 n + 96288) b(n + 5) + --------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2779 n + 62073 n + 469100 n + 1196448) b(n + 6) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (915 n + 32374 n + 348995 n + 1187704) b(n + 7) + 1/2 ------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1265 n + 65070 n + 854836 n + 3347712) b(n + 8) - 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2039 n + 110352 n + 1527949 n + 6306432) b(n + 9) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (233 n + 7014 n + 43294 n - 50514) b(n + 10) - 1/3 ---------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (2576 n + 128403 n + 1965073 n + 9540192) b(n + 11) - 1/6 ----------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (3815 n + 182034 n + 2771779 n + 13664040) b(n + 12) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (230 n + 36177 n + 859681 n + 5586654) b(n + 13) - 1/6 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (790 n + 30120 n + 374437 n + 1504222) b(n + 14) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (5555 n + 234558 n + 3278533 n + 15147966) b(n + 15) + 1/6 ------------------------------------------------------ (n + 18) (n + 22) (n + 21) 3 2 (372 n + 16392 n + 239811 n + 1164842) b(n + 16) - -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (346 n + 17883 n + 305455 n + 1723402) b(n + 17) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (1876 n + 97989 n + 1700417 n + 9798390) b(n + 18) + 1/6 ---------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (385 n + 20949 n + 378914 n + 2277356) b(n + 19) - 1/2 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 3 2 (197 n + 11163 n + 210262 n + 1316016) b(n + 20) + 1/3 -------------------------------------------------- (n + 18) (n + 22) (n + 21) 2 (37 n + 1401 n + 13184) b(n + 21) - 1/3 ---------------------------------- + b(n + 22) = 0 (n + 22) (n + 18) Subject to the initial conditions b(1) = 0, b(2) = 0, b(3) = 0, b(4) = 1, b(5) = 4, b(6) = 12, b(7) = 31, b(8) = 73, b(9) = 162, b(10) = 345, b(11) = 716, b(12) = 1462, b(13) = 2959, b(14) = 5965, b(15) = 12013, b(16) = 24206, b(17) = 48822, b(18) = 98550, b(19) = 198999, b(20) = 401783, b(21) = 810802, b(22) = 1635017 This enables us to compute the first, 20000, terms of these sequences The probability of Alice winning the bet, as n grows larger is approximately 0.63472 1/2 - ------- 1/2 n The probability of Bob winning the bet, as n grows larger is approximately 0.4937 1/2 - ------ 1/2 n You can see that indeed Bob has a better chance, but not significantly so. ----------------------------------------- This took, 33.025, seconds to generate The best bet against, [1, 2, 2, 2], is a member of, {[1, 1, 1, 2], [1, 1, 2, 2], [2, 1, 1, 1], [2, 2, 1, 1], [2, 2, 2, 1]}, and then your edge, if you have n rolls, is exactly 0 The next best bet is a member of, {[1, 1, 2, 1], [1, 2, 1, 1], [1, 2, 2, 1]}, 0.14102 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[2, 1, 1, 2]}, 0.16282 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[2, 2, 1, 2]}, 0.19941 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[2, 1, 2, 2]}, 0.19943 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[2, 1, 2, 1]}, 0.28206 and then your edge is approximately, - ------- 1/2 n The next best bet is a member of, {[1, 2, 1, 2]}, 0.2821 and then your edge is approximately, - ------ 1/2 n The next best bet is a member of, {[1, 1, 1, 1]}, 0.746391 and then your edge is approximately, - -------- 1/2 n The next best bet is a member of, {[2, 2, 2, 2]}, 0.987463 and then your edge is approximately, - -------- 1/2 n ----------------------- This ends this chapter that took, 279.359, seconds to generate. -------------------------------------------------------- This ends this book that took, 2301.272, seconds to generate.