How to find Sum = √(2+√(2+√(2+... ) n times? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to find Sum = √(2+√(2+√(2+... ) n times?

algorithm

19th Sep 2017, 6:34 PM
Ann
Ann - avatar
5 Answers
+ 13
//another method to tackle this (convert this to quadratic expression code) x = sum x^2 = 2 + x(n-1) ::::> x^2 +x (1-n)-2 solve this quadratic for each value of n (n is no. of times root we have taken or no. of times 2 is written) if x tends to infinite .. then x^2 = 2 + x x = 2 , -1 (-1rejected) therefore 2 is answer //sometimes basic math helps u //hope it helps ☺
19th Sep 2017, 10:40 PM
Changed
Changed - avatar
+ 5
* Create a variable to keep track of the current sum * Use a for loop that runs n times * Add 2 to the sum, then square root the whole sum
19th Sep 2017, 6:41 PM
Rrestoring faith
Rrestoring faith - avatar
+ 5
Ah yes. I editted my original comment. Adding 2, then square rooting everything is what you need. That will approach 2 as n gets larger.
19th Sep 2017, 6:56 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
There must be a common long root for the whole expression. is it the same thing as √2 + √2?
19th Sep 2017, 6:48 PM
Ann
Ann - avatar
+ 1
Oh thank you very much, you really helped me
19th Sep 2017, 7:01 PM
Ann
Ann - avatar