+ 6

Challenge: converged limit of infinite sqrt(n)

In math, sqrt(n+sqrt(n+sqrt(n+...))) has its limit. Interestingly, many limits of this kind are positive integers. Write a code to find all "integer limit"s and their corresponding "n"s, within the input number "n". (i.e. from 0 to n) The output should look like "n -- limit" or something like this. I wonder that all the "n"s that match this "interger limit" condition may act as a arithmetic progression(A.P.). sqrt=square root example: 2 -- 2 ; 6 -- 3 ; 12 -- 4 Checking convergence may help.

10th Aug 2017, 2:04 PM
æŽç«‹ćš
5 Answers
+ 10
The values of 'n' so that 'sqrt(n+sqrt(...))' is an integer are 0, 2, 6, 12, 20, ... It's not an arithmetic progression. But observe the differences of consecutive terms 2, 4, 6, 8, ... which is an arithmetic progression. Here's my try: https://code.sololearn.com/Wr0q8lNC0tSL/?ref=app
10th Aug 2017, 3:58 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 7
https://code.sololearn.com/cs0DUKIThMAK/?ref=app
11th Aug 2017, 4:21 AM
Hatsy Rei
Hatsy Rei - avatar
0
If your serie U(p+1)=sqrt(U(p)+n) has a limit l then l verifies l^2=l+n. By using the quadratic equation you can show that the positive solution is l=(1+sqrt(1+4n))/2. By expressing when this is equals an integer k you will solve your problem
10th Aug 2017, 2:49 PM
VcC
VcC - avatar
- 1
no one gave the NEGETIVE LIMITS... THERE WILL ALWAYS BE 2 LIMITS.. ONE (+ ) AND ONE( -) https://code.sololearn.com/cEd8ivh94y04/?ref=app https://code.sololearn.com/cV4CWKWeza52/?ref=app this is another version simplified "observe how the multiplicatipn of i and i-1 is the number where i is the positive limit of that number"
12th Aug 2017, 11:45 AM
sayan chandra
sayan chandra - avatar