-Mark

]]>So that instead off one half odds I could put in 0.4 odds or similar? ]]>

entering any Px between 0 and 1, where Px is the probability

of success on each trial (0.51 for your biased coin). See my

web site for further info:

http://home.ptd.net/~artnpeg/RUNS.html

Art

]]>of N. To prevent overflow, I work with chunks of 1,000. The

initial “seed” values are divided by 2 ^ 1000 and thereafter the last 30 of 1000 are divided by that same divisor then

copied to the bottom of a small working array forming a kind of “seed” for the next 1,000. (30 is a max limit I set more or less arbitrarily as a max run length). A final divisor is

of course set as well.

The method is relatively fast. My DOS program does the

(1,000,000)(20) calculation in 7.35 seconds. A recursive

method takes considerably longer (about 2 minutes). This is on a old pentium 4 2 ghz machine.

Art

]]>approximation for problems like this. This term means the

probability of no occurences, so subtracting its value from

1 gives the probability of at least one occurence.

find Px = 2 ^ (K +1) where K is run length

find A = N – K -1 where N is the # of tosses

then q = A / Px

and P0 = epsilon ^(-q)

finally, P = 1 – P0

For the (1,000,000)(20) example, the approximation yields

P = 0.379250

Incidently, I’ve used the inclusive definition of a run,

meaning the run may be of either heads or tails. I did this

to get agreement with Mark’s solution. If someone insists

on strictly heads exclusively (or tails exclusively) you

could add 1 to the run length to get the correct answer

for the lower probability.

Art

]]>Yes, you’ve made a mistake somewhere. You don’t want Fib(10), you want the n-step Fib(10). I don’t think there is a direct way to calculate this in Mathematica, so I can’t lead you to the results easily. However, you can modify the code I included with the article quite easily to get it straight.

- Mark

]]>Sorry, I have not – seems like a pretty good problem though!

- Mark

]]>