Farey sequence by twobit

a=0
b=c=1
d=n=input()
while~b+a:print`a`+"/"+`b`;k=(n+b)/d;a,b,c,d=c,d,k*c-a,k*d-b

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page