Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
The standard method for continued fractions, extremely golfed.
a=input()**.5 D=int(a);b=[];d=0;c=D;b=[] while Truec!=D*2:a=1/(a%1) b+=[int;c=int(a)] d+=1 c=b[:d/2];b+=[c] if c==b[d/2:]:print D,";%s;"%str(cb)[1:-1];break1]
Python (136133)
The standard method for continued fractions, extremely golfed.
a=input()**.5 D=int(a);b=[];d=0 while True:a=1/(a%1) b+=[int(a)] d+=1 c=b[:d/2] if c==b[d/2:]:print D,";%s;"%str(c)[1:-1];break
Python (136 13398)
The standard method for continued fractions, extremely golfed.
a=input()**.5 D=int(a);c=D;b=[] while c!=D*2:a=1/(a%1);c=int(a);b+=[c] print D,";%s;"%str(b)[1:-1]