迭代开根号

(m+2n)^2 = m^2 + 4*n^2 + 4*m*n
3*m^2 + 6*m*n + 3*n^2
m^2 + 6*m*n + 9*n^2
= 3*n^2 + m^2 - delta + m^2 - delta
(m+2n)^2 = 3(m+n)^2 - 2*delta
####难道说 (m+4n)^2 = 4(m+n)^2
即如果 m^2=x*n^2
则(m+x*n)^2 = x*(m+n)^2


import math
nn=3
def sq_nn(m,n):
    for i in xrange(20):
        m,n=m+nn*n,m+n
    print float(m)/n
sq_nn(nn,1)
print math.sqrt(nn)