What should the result be for P( 1, 1, 1 )?
My interpretation is that each term will be: P( 1 - 1 )P( ... )
Which as 1 - 1 will always be zero, the results of the multiplication is zero, so the overall results will be zero?
If this is the case, then herveus' solution is incorrect as given input of ( 1, 1, 1 ), he returns 1.
If I'm correct, of which there is no guarentee, then I think that the problem lies with his simple expedient of prefixing the list with a 0 to get around the "indices starting from 1" problem, which is causing the function to iterate and recurse once too often.
In reply to Re: recursive formula.
by BrowserUk
in thread recursive formula.
by BioGeek
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>