Unformatted text preview: 1 + 1 3 2 + 1 5 2 + 1 7 2 + Â· Â· Â· Write a script that evaluates this expression, ignoring all terms that are strictly smaller than .000001. Your script should display the number of terms summed and the sum. Use a while-loop. Think about the initialization of your variables and the order of computation carefully! In the loop body you need to calculate the value of a term only once. 4. We use the above series for approximating Ï€/ 8 again but with a diï¬€erent stopping criterion. Let the sum of the Â±rst n terms be T n . As n increases one expects the ratio T n T n +1 to approach 1. Write a script to Â±nd the smallest n such that the ratio T n T n +1 > . 9999. Display n and T n . Hint: Now you need to keep track of a current sum and the next sum in the loop. 1...
View Full Document
- Summer '07
- Number Theory, Binary relation, Prime number, twin prime pair